-
Notifications
You must be signed in to change notification settings - Fork 101
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
Replace feed_expiration_date with rules for 7 and 30 days #1245
Changes from all commits
1e1c7eb
6e446a5
9e66488
96ed0f0
12e9ae6
3243868
5e6a95a
601dfbf
06ca44e
b12047b
e31f2d6
df9d47b
74ce84e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,8 @@ | |
* <p>Generated notice: | ||
* | ||
* <ul> | ||
* <li>{@link FeedExpirationDateNotice} | ||
* <li>{@link FeedExpirationDate7DaysNotice} | ||
* <li>{@link FeedExpirationDate30DaysNotice} | ||
* </ul> | ||
*/ | ||
@GtfsValidator | ||
|
@@ -53,9 +54,9 @@ public void validate(GtfsFeedInfo entity, NoticeContainer noticeContainer) { | |
GtfsDate currentDate = GtfsDate.fromLocalDate(now); | ||
GtfsDate currentDatePlusSevenDays = GtfsDate.fromLocalDate(now.plusDays(7)); | ||
GtfsDate currentDatePlusThirtyDays = GtfsDate.fromLocalDate(now.plusDays(30)); | ||
if (entity.feedEndDate().isBefore(currentDatePlusSevenDays)) { | ||
if (entity.feedEndDate().compareTo(currentDatePlusSevenDays) <= 0) { | ||
noticeContainer.addValidationNotice( | ||
new FeedExpirationDateNotice( | ||
new FeedExpirationDate7DaysNotice( | ||
entity.csvRowNumber(), | ||
currentDate, | ||
entity.feedEndDate(), | ||
|
@@ -64,7 +65,7 @@ public void validate(GtfsFeedInfo entity, NoticeContainer noticeContainer) { | |
} | ||
if (entity.feedEndDate().compareTo(currentDatePlusThirtyDays) <= 0) { | ||
noticeContainer.addValidationNotice( | ||
new FeedExpirationDateNotice( | ||
new FeedExpirationDate30DaysNotice( | ||
entity.csvRowNumber(), | ||
currentDate, | ||
entity.feedEndDate(), | ||
|
@@ -73,13 +74,32 @@ public void validate(GtfsFeedInfo entity, NoticeContainer noticeContainer) { | |
} | ||
} | ||
|
||
static class FeedExpirationDateNotice extends ValidationNotice { | ||
static class FeedExpirationDate7DaysNotice extends ValidationNotice { | ||
private final long csvRowNumber; | ||
private final GtfsDate currentDate; | ||
private final GtfsDate feedEndDate; | ||
private final GtfsDate suggestedExpirationDate; | ||
|
||
FeedExpirationDateNotice( | ||
FeedExpirationDate7DaysNotice( | ||
long csvRowNumber, | ||
GtfsDate currentDate, | ||
GtfsDate feedEndDate, | ||
GtfsDate suggestedExpirationDate) { | ||
super(SeverityLevel.WARNING); | ||
this.csvRowNumber = csvRowNumber; | ||
this.currentDate = currentDate; | ||
this.feedEndDate = feedEndDate; | ||
this.suggestedExpirationDate = suggestedExpirationDate; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to specify a suggested expiration date here? The real suggestion is for as long as the operator is confident that the schedule will continue to be operated, as per the Best Practices. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we don't need it, but if you look at the original |
||
} | ||
} | ||
|
||
static class FeedExpirationDate30DaysNotice extends ValidationNotice { | ||
private final long csvRowNumber; | ||
private final GtfsDate currentDate; | ||
private final GtfsDate feedEndDate; | ||
private final GtfsDate suggestedExpirationDate; | ||
|
||
FeedExpirationDate30DaysNotice( | ||
long csvRowNumber, | ||
GtfsDate currentDate, | ||
GtfsDate feedEndDate, | ||
|
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.
this table doesn't render, I think we need a line break after "Notice fields description".