Skip to content

Commit e9200c1

Browse files
authored
feat: standardize empty value on report.json (#2004)
1 parent 2efab9c commit e9200c1

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

core/src/main/java/org/mobilitydata/gtfsvalidator/reportsummary/AgencyMetadata.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public class AgencyMetadata {
1010
public AgencyMetadata(String name, String url, String phone, String email, String timezone) {
1111
this.name = name;
1212
this.url = url;
13-
this.phone = phone.isEmpty() ? "N/A" : phone;
14-
this.email = email.isEmpty() ? "N/A" : email;
15-
this.timezone = timezone.isEmpty() ? "N/A" : timezone;
13+
this.phone = phone.isEmpty() ? "" : phone;
14+
this.email = email.isEmpty() ? "" : email;
15+
this.timezone = timezone.isEmpty() ? "" : timezone;
1616
}
1717
}

main/src/main/java/org/mobilitydata/gtfsvalidator/reportsummary/model/FeedMetadata.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -431,16 +431,15 @@ private void loadFeedInfo(
431431
var info = feedTable.getEntities().isEmpty() ? null : feedTable.getEntities().get(0);
432432

433433
feedInfo.put(
434-
JsonReportFeedInfo.FEED_INFO_PUBLISHER_NAME,
435-
info == null ? "N/A" : info.feedPublisherName());
434+
JsonReportFeedInfo.FEED_INFO_PUBLISHER_NAME, info == null ? "" : info.feedPublisherName());
436435
feedInfo.put(
437-
JsonReportFeedInfo.FEED_INFO_PUBLISHER_URL, info == null ? "N/A" : info.feedPublisherUrl());
436+
JsonReportFeedInfo.FEED_INFO_PUBLISHER_URL, info == null ? "" : info.feedPublisherUrl());
438437
feedInfo.put(
439438
JsonReportFeedInfo.FEED_INFO_FEED_CONTACT_EMAIL,
440-
info == null ? "N/A" : info.feedContactEmail());
439+
info == null ? "" : info.feedContactEmail());
441440
feedInfo.put(
442441
JsonReportFeedInfo.FEED_INFO_FEED_LANGUAGE,
443-
info == null ? "N/A" : info.feedLang().getDisplayLanguage());
442+
info == null ? "" : info.feedLang().getDisplayLanguage());
444443
if (feedTable.hasColumn(GtfsFeedInfo.FEED_START_DATE_FIELD_NAME)) {
445444
if (info != null) {
446445
LocalDate localDate = info.feedStartDate().getLocalDate();
@@ -458,7 +457,7 @@ private void loadFeedInfo(
458457
private String checkLocalDate(LocalDate localDate) {
459458
String displayDate;
460459
if (localDate.toString().equals(LocalDate.EPOCH.toString())) {
461-
displayDate = "N/A";
460+
displayDate = "";
462461
} else {
463462
displayDate = localDate.toString();
464463
}
@@ -568,12 +567,12 @@ public void loadServiceWindow(
568567
} finally {
569568
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM d, yyyy");
570569
if ((earliestStartDate == null) && (latestEndDate == null)) {
571-
feedInfo.put(JsonReportFeedInfo.FEED_INFO_SERVICE_WINDOW, "N/A");
570+
feedInfo.put(JsonReportFeedInfo.FEED_INFO_SERVICE_WINDOW, "");
572571
} else if (earliestStartDate == null && latestEndDate != null) {
573572
feedInfo.put(JsonReportFeedInfo.FEED_INFO_SERVICE_WINDOW, latestEndDate.format(formatter));
574573
} else if (latestEndDate == null && earliestStartDate != null) {
575574
if (earliestStartDate.isAfter(latestEndDate)) {
576-
feedInfo.put(JsonReportFeedInfo.FEED_INFO_SERVICE_WINDOW, "N/A");
575+
feedInfo.put(JsonReportFeedInfo.FEED_INFO_SERVICE_WINDOW, "");
577576
} else {
578577
feedInfo.put(
579578
JsonReportFeedInfo.FEED_INFO_SERVICE_WINDOW, earliestStartDate.format(formatter));

main/src/main/resources/report.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ <h4>Feed Info</h4>
269269
<div th:with="isNotServiceWindow=${info.key != 'Service Window Start' and info.key != 'Service Window End'}">
270270
<dd th:if="${isNotServiceWindow}" th:text="${info.key} + ':'" />
271271
<dt th:if="${isNotServiceWindow}">
272-
<span th:if="${info.key.contains('URL') and info.value != 'N/A'}">
272+
<span th:if="${info.key.contains('URL') and not info.value.isEmpty()}">
273273
<a th:href="${info.value}" target="_blank" th:text="${info.value}" />
274274
</span>
275-
<span th:if="${info.key.contains('URL') and info.value == 'N/A'}" th:text="${info.value}"></span>
275+
<span th:if="${info.value.isEmpty()}">N/A</span>
276276
<span th:unless="${info.key.contains('URL')}" th:text="${info.value}"/>
277277
<span th:if="${info.key == 'Service Window'}" >
278278
<a href="#" class="tooltip" onclick="event.preventDefault();"><span>(?)</span>

0 commit comments

Comments
 (0)