Skip to content

Conversation

@leonardehrenfried
Copy link
Member

Summary

Previously OBA used the value 0 in booking rules times meaning "no value". This is problematic because 0 is also a valid value meaning either midnight of zero.

OBA now uses NO_VALUE (-999) to mean "no value" and so the GTFS import had to be changed, too.

Unit tests

Added.

Documentation

Javadoc update.

@leonardehrenfried leonardehrenfried added this to the 2.9 (next release) milestone Nov 6, 2025
@leonardehrenfried leonardehrenfried requested a review from a team as a code owner November 6, 2025 13:24
@leonardehrenfried leonardehrenfried added !Improvement A functional improvement or micro feature +GTFS Related to import of GTFS data labels Nov 6, 2025
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.11%. Comparing base (81b7e80) to head (6c97630).
⚠️ Report is 154 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...pentripplanner/gtfs/mapping/BookingRuleMapper.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #7029      +/-   ##
=============================================
- Coverage      72.12%   72.11%   -0.02%     
- Complexity     20042    20055      +13     
=============================================
  Files           2175     2177       +2     
  Lines          80860    80929      +69     
  Branches        8127     8135       +8     
=============================================
+ Hits           58322    58359      +37     
- Misses         19672    19697      +25     
- Partials        2866     2873       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, just a line of documentation that needs updating. It would be nice if oba had a more explict api with optionals. Having magic numbers like this feels very fragile and scary.

leonardehrenfried and others added 2 commits November 7, 2025 07:53
Co-authored-by: Henrik Abrahamsson <127481124+habrahamsson-skanetrafiken@users.noreply.github.com>
@leonardehrenfried
Copy link
Member Author

This looks fine, just a line of documentation that needs updating. It would be nice if oba had a more explict api with optionals. Having magic numbers like this feels very fragile and scary.

These magic numbers are awful but changing this would be a whole different library. If we want to change the approach of reading GTFS I think we should switch to streaming GTFS files line by line rather than reading the whole thing into memory, like I have done here: #6754

@habrahamsson-skanetrafiken
Copy link
Contributor

Ah, I hadn't seen that PR. It looks like a good improvement IMO.

Copy link
Contributor

@habrahamsson-skanetrafiken habrahamsson-skanetrafiken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

rule.setPriorNoticeLastTime(0);
rule.setPriorNoticeLastDay(0);
var rule = rule("3");
// when either of prior notice time and day are set to -999(NO_VALUE), they should be treated as "not set".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// when either of prior notice time and day are set to -999(NO_VALUE), they should be treated as "not set".
// when either of prior notice time and day are set to -999 (NO_VALUE), they should be treated as "not set".

@leonardehrenfried leonardehrenfried merged commit 772ae72 into opentripplanner:dev-2.x Nov 13, 2025
8 checks passed
t2gran pushed a commit that referenced this pull request Nov 13, 2025
@leonardehrenfried leonardehrenfried deleted the booking-rule-mapping branch November 13, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

+GTFS Related to import of GTFS data !Improvement A functional improvement or micro feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants