-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 1534 service window in summary report #1837
base: master
Are you sure you want to change the base?
Conversation
📝 Acceptance Test Report📋 Summary✅ The rule acceptance has passed for commit 039dbfa 📊 Notices ComparisonNew Errors (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Errors (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. New Warnings (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Warnings (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. 🛡️ Corruption Check7 out of 1575 sources (~0 %) are corrupted.
⏱️ Performance Assessment📈 Validation TimeAssess the performance in terms of seconds taken for the validation process.
|
📝 Acceptance Test Report📋 Summary✅ The rule acceptance has passed for commit a12fcf6 📊 Notices ComparisonNew Errors (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Errors (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. New Warnings (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Warnings (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. 🛡️ Corruption Check7 out of 1575 sources (~0 %) are corrupted.
⏱️ Performance Assessment📈 Validation TimeAssess the performance in terms of seconds taken for the validation process.
|
main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/FeedMetadata.java
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/FeedMetadata.java
Show resolved
Hide resolved
GtfsTableContainer<GtfsTrip> tripContainer, | ||
GtfsTableContainer<GtfsCalendar> calendarTable, | ||
GtfsTableContainer<GtfsCalendarDate> calendarDateTable) { | ||
List<GtfsTrip> trips = tripContainer.getEntities(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure tripContainer cannot be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://gtfs.org/documentation/schedule/reference/#tripstxt, trips.txt is required, so I assumed it's non null, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if trips.txt is absent it will give a error notice, but do we have a guarantee that the code here will not be reached in that case? If it is, we'll get an NPE which in general is not good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it could be empty. I'll add the logic.
This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: |
This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: |
LocalDate startDate = calendar.startDate().getLocalDate(); | ||
LocalDate endDate = calendar.endDate().getLocalDate(); | ||
|
||
if (startDate != null || endDate != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these be null or will they be some default (e.g. 1970-01-01) if the date is not in the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, they can be unix time 1970-01-01, in that case, we should just display N/A
String serviceId = trip.serviceId(); | ||
for (GtfsCalendarDate calendarDate : calendarDates) { | ||
if (calendarDate.serviceId().equals(serviceId)) { | ||
LocalDate date = calendarDate.date().getLocalDate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you should check if the exception_type is addition before using it in the calculation, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When only calendar_dates.txt is used, can we assume that the exception_type is always 1? @emmambd
main/src/test/java/org/mobilitydata/gtfsvalidator/report/model/FeedMetadataTest.java
Outdated
Show resolved
Hide resolved
📝 Acceptance Test Report📋 Summary✅ The rule acceptance has passed for commit ce2a0f1 📊 Notices ComparisonNew Errors (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Errors (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. New Warnings (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Warnings (0 out of 1568 datasets, ~0%) ✅No changes were detected due to the code change. 🛡️ Corruption Check7 out of 1575 sources (~0 %) are corrupted.
⏱️ Performance Assessment📈 Validation TimeAssess the performance in terms of seconds taken for the validation process.
|
} | ||
} | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM d, yyyy"); | ||
if ((earliestStartDate == null) && (latestEndDate == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this generate an NPE if earliestStartDate is null and latestEndDate is not null?
List<GtfsCalendar> calendars = calendarTable.getEntities(); | ||
for (GtfsTrip trip : trips) { | ||
String serviceId = trip.serviceId(); | ||
for (GtfsCalendar calendar : calendars) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this loop be replaced by something like this:
GtfsCalendar calendar = ((GtfsCalendarTableContainer) calendarTable).byServiceId(serviceId);
List<GtfsCalendarDate> calendarDates = calendarDateTable.getEntities(); | ||
for (GtfsTrip trip : trips) { | ||
String serviceId = trip.serviceId(); | ||
for (GtfsCalendarDate calendarDate : calendarDates) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this loop be replaced by something like this:
GtfsCalendarDate calendarDate = ((GtfsCalendarDateTableContainer) calendarDateTable).byServiceId(serviceId);
Summary:
Closes #1534
Expected behavior:
GTFS Validator report should show Service Date Range under Feed Info section.
When only calendar_dates.txt is used
test dataset:
poa_gtfs.zip
)
When only calendar_dates.txt is used
test dataset:
Google_transit.zip
When both calendars.txt and calendar_dates.txt are used
test dataset:
Archive.zip
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle test
to make sure you didn't break anything