Skip to content

Commit

Permalink
Merge 0626d40 into 65cb9a9
Browse files Browse the repository at this point in the history
  • Loading branch information
qcdyx authored Mar 4, 2025
2 parents 65cb9a9 + 0626d40 commit 6bce44d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public PickupBookingRuleIdValidator(
public void validate(GtfsStopTime entity, NoticeContainer noticeContainer) {
if (entity.hasPickupType()
&& entity.pickupType() == GtfsPickupDropOff.MUST_PHONE
&& entity.hasStartPickupDropOffWindow()
&& !entity.hasPickupBookingRuleId()) {
noticeContainer.addValidationNotice(
new MissingPickupDropOffBookingRuleIdNotice(
Expand All @@ -34,6 +35,7 @@ public void validate(GtfsStopTime entity, NoticeContainer noticeContainer) {
}
if (entity.hasDropOffType()
&& entity.dropOffType() == GtfsPickupDropOff.MUST_PHONE
&& entity.hasEndPickupDropOffWindow()
&& !entity.hasDropOffBookingRuleId()) {
noticeContainer.addValidationNotice(
new MissingPickupDropOffBookingRuleIdNotice(
Expand Down Expand Up @@ -61,8 +63,12 @@ public boolean shouldCallValidate() {
}

/**
* `pickup_booking_rule_id` is recommended when `pickup_type=2` and `drop_off_booking_rule_id` is
* recommended when `drop_off_type=2`
* pickup_booking_rule_id is recommended when pickup_type=2 and drop_off_booking_rule_id is
* recommended when drop_off_type=2.
*
* <p>Currently, this notice is only triggered on feeds when either start_pickup_drop_off_window
* or end_pickup_drop_off_window is defined, since this recommendation was added to the
* specification for feeds with GTFS-Flex.
*/
@GtfsValidationNotice(
severity = SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.mobilitydata.gtfsvalidator.notice.ValidationNotice;
import org.mobilitydata.gtfsvalidator.table.GtfsPickupDropOff;
import org.mobilitydata.gtfsvalidator.table.GtfsStopTime;
import org.mobilitydata.gtfsvalidator.type.GtfsTime;

@RunWith(JUnit4.class)
public class PickupBookingRuleIdValidatorTest {
Expand All @@ -27,6 +28,7 @@ public void missingBookingRuleIdShouldGenerateNotice() {
new GtfsStopTime.Builder()
.setCsvRowNumber(1)
.setPickupType(GtfsPickupDropOff.MUST_PHONE)
.setStartPickupDropOffWindow(GtfsTime.fromSecondsSinceMidnight(18614))
.build();
assertThat(generateNotices(stopTime))
.containsExactly(
Expand All @@ -40,7 +42,8 @@ public void existingBookingRuleIdShouldNotGenerateNotice() {
new GtfsStopTime.Builder()
.setCsvRowNumber(2)
.setPickupType(GtfsPickupDropOff.MUST_PHONE)
.setPickupBookingRuleId("bookingRuleId")
.setStartPickupDropOffWindow(GtfsTime.fromSecondsSinceMidnight(18614))
.setPickupBookingRuleId("booking_rule_id")
.build();
assertThat(generateNotices(stopTime)).isEmpty();
}
Expand Down

0 comments on commit 6bce44d

Please sign in to comment.