Skip to content
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

Flex filtering preview #247

Open
wants to merge 187 commits into
base: ibi-dev-2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
36336bf
Add ability to create special transfer requests for cars and bikes wi…
VillePihlava Nov 1, 2024
f1380e3
Add tests for 'carsAllowedStopMaxTransferDurationsForMode' build conf…
VillePihlava Nov 1, 2024
2175e64
Move if statement outside of for loop.
VillePihlava Nov 1, 2024
6418e26
Merge branch 'dev-2.x' of github.com:opentripplanner/OpenTripPlanner …
VillePihlava Nov 5, 2024
e1e9bbb
Fixes based on review comments.
VillePihlava Dec 3, 2024
89e617f
Add TransferParameters to build config.
VillePihlava Dec 3, 2024
a1e0807
Remove mentions of carsAllowedStopMaxTransferDurationsForMode and fix…
VillePihlava Dec 3, 2024
21bb307
Rename variables and small improvements.
VillePihlava Dec 5, 2024
573078a
Change test.
VillePihlava Dec 5, 2024
3fd5bf5
Add documentation for build config fields.
VillePihlava Dec 5, 2024
35c98bc
Add logging for transfers.
VillePihlava Dec 5, 2024
3a34aa4
Merge branch 'split-transfers-by-mode-pathtransfer-mode' into car-tra…
VillePihlava Dec 5, 2024
97238a3
Fix merge issues.
VillePihlava Dec 5, 2024
41a0674
Add tests and small improvements.
VillePihlava Dec 10, 2024
0440bac
Restructuring of the layout of the UI. Moved generated arguments to l…
a-limyr Dec 16, 2024
3e74e7e
Forgotten fil
a-limyr Dec 16, 2024
1a3f846
Merge branch 'dev-2.x' of github.com:opentripplanner/OpenTripPlanner …
VillePihlava Dec 16, 2024
2e048f9
Refactor transfer parameter parsing.
VillePihlava Dec 16, 2024
c90c3ec
Remove duplicate test.
VillePihlava Dec 16, 2024
30cc925
Simplify implementation by removing changes to StreetNearbyStopFinder.
VillePihlava Dec 17, 2024
2e57c2f
Remove unnecessary parameter from function call.
VillePihlava Dec 17, 2024
f2296cd
Add formatting for JSON in documentation.
VillePihlava Jan 7, 2025
0ac172e
Rename variables.
VillePihlava Jan 7, 2025
bff77a5
Refactor transfer generation.
VillePihlava Jan 7, 2025
9f5d63c
Rename transfers to transferParameters in the build config and throw …
VillePihlava Jan 7, 2025
4f84804
Change wording of documentation.
VillePihlava Jan 7, 2025
4d599a2
Add comments and refactor transfer generation.
VillePihlava Jan 7, 2025
2eb0912
Rename transfers to transferParameters in documentation.
VillePihlava Jan 7, 2025
7fb3810
add currentFuelPercent to VehicleRentalVehicle and gtfs graphql API
JustCris654 Nov 5, 2024
b61c9f3
add currentRangeMeters to VehicleRentalVehicle and gtfs graphql API
JustCris654 Nov 22, 2024
1fa55b0
fix comment typo
JustCris654 Nov 22, 2024
4686f7c
use Distance class for currentRangeMeters
JustCris654 Dec 2, 2024
e93c828
add greater and less than methods for Distance
JustCris654 Dec 2, 2024
49c4682
Distance class tests
JustCris654 Dec 2, 2024
54292e2
represent currentRangeMeters with integer type
JustCris654 Dec 3, 2024
851c8b5
format RentalVehicleImpl file
JustCris654 Dec 3, 2024
d26799f
proper naming for static variables
JustCris654 Dec 3, 2024
e0bd36a
use Ratio scalar for currentFuelPercent
JustCris654 Dec 4, 2024
e9a572d
rename currentRangeMeters to currentRange
JustCris654 Dec 4, 2024
498d547
move conversion of Distance to-from meters to the api and gbfs mapping
JustCris654 Dec 4, 2024
eda75c8
remove unused code Distance class
JustCris654 Dec 4, 2024
3e7bf5b
group range and percent in fuel type
JustCris654 Dec 9, 2024
7d15f00
log warn if fuelPercent is invalid
JustCris654 Dec 9, 2024
9b9b585
check currentRangeMeters validity in free rental vehicle
JustCris654 Dec 11, 2024
c90bdd4
Ratio class
JustCris654 Dec 11, 2024
346449b
Ratio class for fuel percent validation
JustCris654 Dec 17, 2024
6edf98b
Ratio class and test format
JustCris654 Dec 17, 2024
0b1920d
fix check when range is required
JustCris654 Dec 17, 2024
54b0bc0
format GbfsFreeVehicleStatusMapper
JustCris654 Dec 17, 2024
f3e0a71
add range to scooter in GbfsFreeVehicleStatusMapperTest
JustCris654 Dec 17, 2024
26d8d7d
general fixes Ratio.java and Distance.java
JustCris654 Jan 7, 2025
5aa5a39
Allow SIRI and GTFS at the same time
leonardehrenfried Dec 22, 2024
7b75761
Fix cyclic dependency
leonardehrenfried Dec 23, 2024
e2c9a20
Fix some tests
leonardehrenfried Dec 23, 2024
dc8c8d0
Add diagram
leonardehrenfried Dec 23, 2024
bde1a38
Use easy instantiation of DefaultTransitService
leonardehrenfried Dec 23, 2024
1c2a269
Fix GraphQL test
leonardehrenfried Dec 23, 2024
0b1a994
Update diagram
leonardehrenfried Dec 23, 2024
0585926
Add javadoc
leonardehrenfried Dec 23, 2024
081bcbf
Fix some tests
leonardehrenfried Dec 24, 2024
228f8af
Allow running SIRI & GTFS-RT in tests
leonardehrenfried Dec 24, 2024
bca8739
Make integration tests pass
leonardehrenfried Dec 25, 2024
5308651
Move transit layer-related methods to TimetableRepository
leonardehrenfried Dec 25, 2024
bd38946
Fix remaining test
leonardehrenfried Dec 26, 2024
2aa87f3
Remove outdated comment
leonardehrenfried Dec 27, 2024
94ee02c
Polish documentation
leonardehrenfried Jan 2, 2025
fd156b7
Add method
leonardehrenfried Jan 2, 2025
5f8eb10
Rename 'diagrams' to 'design'
leonardehrenfried Jan 7, 2025
ff4b7ae
Use snapshot buffer
leonardehrenfried Jan 8, 2025
79cac16
Nested arguments, list arguments, layout changes, reset button, exclu…
a-limyr Jan 8, 2025
4788055
RentalvehicleFuel properties docs comments
JustCris654 Jan 8, 2025
ff8411a
javadoc comment for Ratio class
JustCris654 Jan 9, 2025
821ec06
Merge branch 'dev-2.x' into debug-client-dynamic-arguments
a-limyr Jan 9, 2025
a994a51
Nested arguments, list arguments, layout changes, reset button, exclu…
a-limyr Jan 9, 2025
c25fab8
Fixed some styling
a-limyr Jan 9, 2025
6778169
check getCurrentFuelPercent null value and drop NPE
JustCris654 Jan 9, 2025
62e671f
Example on factory method with validation error handler passed in as …
t2gran Jan 9, 2025
f7d6b36
Cleanup Ratio implementation
t2gran Jan 9, 2025
57e03b4
Change default values from Duration.ZERO to null.
VillePihlava Jan 14, 2025
7de4a39
Add documentation.
VillePihlava Jan 14, 2025
8e87974
Rename transferParameters to transferParametersForMode.
VillePihlava Jan 14, 2025
d0fbae9
Change documentation for maxTransferDuration.
VillePihlava Jan 14, 2025
f385061
Add documentation to standalone build-config.json and NodeAdapterHelper.
VillePihlava Jan 14, 2025
5c85096
Add mode-specific version of the maxStopCount parameter (maxStopCount…
VillePihlava Jan 14, 2025
df84af5
Fixed some styling
a-limyr Jan 15, 2025
3e1abad
Fixed any type issues + some other things.
a-limyr Jan 15, 2025
c280d67
Merge branch 'dev-2.x' into debug-client-dynamic-arguments
a-limyr Jan 15, 2025
46a094f
Keeping code up to date.
a-limyr Jan 15, 2025
afa1b16
Use method to get field instead of the field directly.
VillePihlava Jan 16, 2025
c649ab7
Change comment style.
VillePihlava Jan 16, 2025
91782ef
Split transfer generation into methods.
VillePihlava Jan 16, 2025
4312caf
throttle invalid current fuel percent log
JustCris654 Jan 16, 2025
cd38992
Merge remote-tracking branch 'otp_master/pr-6272' into rentalVehicle_…
JustCris654 Jan 16, 2025
17a9d79
use Ratio refactor in tests
JustCris654 Jan 16, 2025
c941f62
Merge branch 'dev-2.x' into rentalVehicle_new_gbfs_fields
JustCris654 Jan 16, 2025
c16503a
Extract mapper for bookWhen, add test
leonardehrenfried Jan 17, 2025
5639c31
Add enum values for RelativeDirection in Transmodel API
leonardehrenfried Jan 17, 2025
88d238e
Merge remote-tracking branch 'upstream/dev-2.x' into siri-gtfs
leonardehrenfried Jan 20, 2025
b9cba70
Update method name after merge
leonardehrenfried Jan 20, 2025
6016a89
Add workflow for validating schema changes
optionsome Jan 20, 2025
e179d02
Add maxStopCountForMode to the standalone router config.
VillePihlava Jan 21, 2025
186d20c
Merge branch 'dev-2.x' of github.com:opentripplanner/OpenTripPlanner …
VillePihlava Jan 21, 2025
fe18de1
Refactoring to remove use of "any" types.
a-limyr Jan 21, 2025
71f4b71
Merge branch 'dev-2.x' into debug-client-dynamic-arguments
a-limyr Jan 21, 2025
288d85e
Removed some debug statements and removed use of one any usage.
a-limyr Jan 21, 2025
293339e
Changed logic to avoid generics with any.
a-limyr Jan 21, 2025
bbf8655
Fix React Hook useEffect warning and Fast refresh warning
a-limyr Jan 21, 2025
742bcd0
change distance value from meters to millimeters
JustCris654 Jan 21, 2025
df52961
chore(deps): update dependency vite to v6.0.9 [security]
renovate[bot] Jan 21, 2025
e5ee41b
Merge pull request #6399 from opentripplanner/renovate/npm-vite-vulne…
leonardehrenfried Jan 22, 2025
5ab75af
Upgrade debug client to version 2025/01/2025-01-22T08:30
Jan 22, 2025
4dc1a14
Refactor to avoid warning and a bit of clean-up.
a-limyr Jan 22, 2025
bc9edc2
Refactor to avoid warning and a bit of clean-up.
a-limyr Jan 22, 2025
64e6e41
Refactor to make eslint happy
a-limyr Jan 22, 2025
d448c8b
Merge branch 'dev-2.x' into debug-client-dynamic-arguments
a-limyr Jan 22, 2025
0b4f5d5
Some changes to formatting and a bit other minor changes.
a-limyr Jan 22, 2025
1cf9024
Updates to ignore prettier formatting of generated file.
a-limyr Jan 22, 2025
c5a998d
factory method implementation for Distance
JustCris654 Jan 22, 2025
494d80a
Prevent this action from showing up in forked OTP projects
t2gran Jan 22, 2025
9e30029
expose Ratio and Distance from RentalVehicleFuel class
JustCris654 Jan 22, 2025
c00e615
Merge branch 'dev-2.x' into rentalVehicle_new_gbfs_fields
JustCris654 Jan 22, 2025
8e6d6f1
Fixed link from external to internal schema.
a-limyr Jan 23, 2025
0c2ed2d
Merge pull request #6215 from HSLdevcom/car-transferrequest-filtering
optionsome Jan 23, 2025
b74638f
Add changelog entry for #6215 [ci skip]
Jan 23, 2025
e9a8742
Bump serialization version id for #6215
Jan 23, 2025
aeac1d0
Merge pull request #6383 from HSLdevcom/mode-specific-maxstopcount
optionsome Jan 23, 2025
28bdf41
Add changelog entry for #6383 [ci skip]
Jan 23, 2025
131f301
Added debug layer group toggle, minor style change and removed unused…
a-limyr Jan 23, 2025
1a86905
Merge pull request #6370 from entur/debug-client-dynamic-arguments
leonardehrenfried Jan 23, 2025
a7758b9
Add changelog entry for #6370 [ci skip]
Jan 23, 2025
12b5cb6
Upgrade debug client to version 2025/01/2025-01-23T16:53
Jan 23, 2025
0723ab3
Merge remote-tracking branch 'upstream/dev-2.x' into siri-gtfs
leonardehrenfried Jan 24, 2025
3b01c8c
RentalVehicleFuel make fields private
JustCris654 Jan 24, 2025
c47569f
RentalVehicleFuel fix getters naming
JustCris654 Jan 24, 2025
0185022
fix Distance javadoc and equals method
JustCris654 Jan 24, 2025
cc2fe88
Merge pull request #6393 from leonardehrenfried/fix-transmodel
leonardehrenfried Jan 24, 2025
6285003
fix(deps): update highly trusted dependencies (patch)
renovate[bot] Jan 27, 2025
185c038
Merge pull request #6405 from opentripplanner/renovate/highly-trusted…
leonardehrenfried Jan 27, 2025
a8ad459
Automerge trusted dependencies [ci skip]
leonardehrenfried Jan 27, 2025
14f2d6b
Configure formatting for sandbox code
leonardehrenfried Jan 24, 2025
706a2a7
Remove lazyGetTimeTableSnapShot()
leonardehrenfried Jan 27, 2025
ed0c782
Re-add log
leonardehrenfried Jan 27, 2025
a643e48
Clean up imports
leonardehrenfried Jan 27, 2025
47dece2
Merge pull request #6272 from JustCris654/rentalVehicle_new_gbfs_fields
optionsome Jan 28, 2025
f8438b2
Add changelog entry for #6272 [ci skip]
Jan 28, 2025
45f1ef5
Add commit to .git-blame-ignore-revs
leonardehrenfried Jan 28, 2025
6675d4a
Merge remote-tracking branch 'upstream/dev-2.x' into sandbox-formatting
leonardehrenfried Jan 28, 2025
3e5fe2f
Format new upstream code
leonardehrenfried Jan 28, 2025
9894c2a
Switch debug client CDN to Github Pages
leonardehrenfried Jan 28, 2025
519cc45
Add whitespace so that a new client version is built
leonardehrenfried Jan 28, 2025
7ff1a3a
Merge pull request #6408 from leonardehrenfried/ui-assets
leonardehrenfried Jan 28, 2025
0c8c3b2
Upgrade debug client to version 2025/01/2025-01-28T11:22
Jan 28, 2025
8f2a2de
Update path of package.json [ci skip]
leonardehrenfried Jan 29, 2025
c740b83
Remove 'this' from DefaultTransitService
leonardehrenfried Jan 29, 2025
d8991eb
Add Nullable annotation
leonardehrenfried Jan 29, 2025
e649a6c
Add a matcher API for filters in the transit service used for route l…
eibakke Jan 29, 2025
7ab6d05
Add changelog entry for #6378 [ci skip]
Jan 29, 2025
6e5a95a
Add 'pull_request -> branches' filter to "Debug Client" workflow
t2gran Jan 29, 2025
c863768
Apply review feedback
leonardehrenfried Jan 29, 2025
c8fbf02
Fix typo
leonardehrenfried Jan 29, 2025
fe5c570
Merge pull request #6396 from HSLdevcom/ci-schema-validation
optionsome Jan 30, 2025
f580998
Change gtfs graphql schema and generated files.
VillePihlava Jan 30, 2025
61872ca
Add boardCost functionality for cars.
VillePihlava Jan 30, 2025
8074f17
Add boardCost field for cars to the router config.
VillePihlava Jan 30, 2025
9a9892c
Add boardCost tests for cars.
VillePihlava Jan 30, 2025
7f5c12c
Merge pull request #6402 from entur/build-otp_debug-client
t2gran Jan 30, 2025
87507f3
Remove unnecessary imports from generated files.
VillePihlava Jan 31, 2025
b19e36e
Update Javadoc to reflect new reality
leonardehrenfried Jan 31, 2025
1ebb824
Merge pull request #6363 from leonardehrenfried/siri-gtfs
leonardehrenfried Feb 3, 2025
f912b21
Add changelog entry for #6363 [ci skip]
Feb 3, 2025
03be5db
Merge pull request #6406 from leonardehrenfried/sandbox-formatting
leonardehrenfried Feb 3, 2025
f19596c
Merge pull request #6413 from HSLdevcom/car-transit-preferences
optionsome Feb 3, 2025
0bd0a69
Add changelog entry for #6413 [ci skip]
Feb 3, 2025
843c7f0
Bump serialization version id for #6413
Feb 3, 2025
6b49bbd
Implement basic flex filtering
leonardehrenfried Jan 24, 2025
27b14d5
Extract reusable method
leonardehrenfried Jan 29, 2025
2b95ccc
Improve logging of large flex areas
leonardehrenfried Jan 29, 2025
85c29c5
Make integration test pass
leonardehrenfried Jan 30, 2025
194619e
Implement separate flex filter logic
leonardehrenfried Jan 31, 2025
f50897e
Convert record to class, add Javadoc
leonardehrenfried Feb 3, 2025
f721ba1
Format code
leonardehrenfried Feb 3, 2025
0cb9162
Add Javadoc
leonardehrenfried Feb 3, 2025
e8139ec
Add test
leonardehrenfried Feb 3, 2025
1665992
Flesh out tests
leonardehrenfried Feb 3, 2025
e05c0c7
Re-organise package structure
leonardehrenfried Feb 3, 2025
fd9e9ef
Revert changes to AreaStopsToVerticesMapper
leonardehrenfried Feb 3, 2025
1289d56
Merge branch 'flex-filtering' into flex-filtering-preview
leonardehrenfried Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ ead33ffe280dd7caf72cae5ff7a41542e8427636

# json file reformatting with prettier
c287575df6798810a69fafc54c8c4e1867b71367

# prettier formatting for sandbox code
14f2d6bc7622649c817e9f45e4d1a9e6dd94847d
8 changes: 6 additions & 2 deletions .github/workflows/debug-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: Debug client

on:
push:
branches:
- dev-2.x
paths:
- 'client/**'
pull_request:
branches:
- dev-2.x
paths:
- 'client/**'

Expand Down Expand Up @@ -41,11 +45,11 @@ jobs:
working-directory: client
run: |
npm install
npm run build -- --base https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/${VERSION}/
npm run build -- --base https://www.opentripplanner.org/debug-client-assets/${VERSION}/
npm run coverage

- name: Deploy compiled assets to repo
if: github.event_name == 'push' && github.ref == 'refs/heads/dev-2.x'
if: github.event_name == 'push'
env:
REMOTE: debug-client
LOCAL_BRANCH: local-assets
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/schema-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Validate schema changes

on:
pull_request:
branches:
- dev-2.x

jobs:
validate-gtfs:
if: github.repository_owner == 'opentripplanner'
name: Validate GraphQL schema changes
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: 'Fetch dev.2.x for diffing'
run: |
git fetch origin dev-2.x --depth 1


- uses: actions/setup-node@v4
with:
node-version: 22

- name: Install GraphQL Inspector
run: |
npm i --global @graphql-inspector/ci graphql @graphql-inspector/diff-command @graphql-inspector/graphql-loader @graphql-inspector/git-loader

- name: Validate GTFS GraphQL schema changes
run: |
graphql-inspector diff 'git:origin/dev-2.x:application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls' 'application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls'

- name: Validate Transmodel GraphQL schema changes
run: |
graphql-inspector diff 'git:origin/dev-2.x:application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql' 'application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ graph.obj
# IntelliJ creates these pid files when you attach the debugger to tests
.attach_pid*

# draw.io backup files
*.svg.bkp

smoke-tests/*.jar
smoke-tests/**/*.obj
smoke-tests/**/*.pbf
Expand Down
16 changes: 15 additions & 1 deletion application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs</artifactId>
<version>5.0.0</version>
<version>5.0.2</version>
</dependency>
<!-- Processing is used for the debug GUI (though we could probably use just Java2D) -->
<dependency>
Expand Down Expand Up @@ -485,6 +485,20 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.hubspot.maven.plugins</groupId>
<artifactId>prettier-maven-plugin</artifactId>
<configuration>
<inputGlobs>
<inputGlob>src/main/java/**/*.java</inputGlob>
<inputGlob>src/ext/java/**/*.java</inputGlob>
<inputGlob>src/test/java/**/*.java</inputGlob>
<inputGlob>src/ext-test/java/**/*.java</inputGlob>
<inputGlob>src/**/*.json</inputGlob>
<inputGlob>src/test/resources/org/opentripplanner/apis/**/*.graphql</inputGlob>
</inputGlobs>
</configuration>
</plugin>
</plugins>
</build>
</project>
6 changes: 3 additions & 3 deletions application/src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OTP Debug</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-20T08:56/assets/index-BKHYHPIc.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-20T08:56/assets/index-BDL0-veX.css">
<script type="module" crossorigin src="https://www.opentripplanner.org/debug-client-assets/2025/01/2025-01-28T11:22/assets/index-BHcP0Ndc.js"></script>
<link rel="stylesheet" crossorigin href="https://www.opentripplanner.org/debug-client-assets/2025/01/2025-01-28T11:22/assets/index-DjMJ6mws.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.Set;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.opentripplanner.ext.fares.model.Distance;
import org.opentripplanner.ext.fares.model.FareDistance;
import org.opentripplanner.ext.fares.model.FareDistance.LinearDistance;
import org.opentripplanner.ext.fares.model.FareLegRule;
Expand All @@ -23,6 +22,7 @@
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.PlanTestConstants;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.basic.Distance;
import org.opentripplanner.transit.model.basic.Money;
import org.opentripplanner.transit.model.framework.FeedScopedId;

Expand Down Expand Up @@ -331,15 +331,30 @@ class DistanceFares {
List<FareLegRule> distanceRules = List.of(
FareLegRule
.of(DISTANCE_ID, tenKmProduct)
.withFareDistance(new LinearDistance(Distance.ofKilometers(7), Distance.ofKilometers(10)))
.withFareDistance(
new LinearDistance(
Distance.ofKilometersBoxed(7d, ignore -> {}).orElse(null),
Distance.ofKilometersBoxed(10d, ignore -> {}).orElse(null)
)
)
.build(),
FareLegRule
.of(DISTANCE_ID, threeKmProduct)
.withFareDistance(new LinearDistance(Distance.ofKilometers(3), Distance.ofKilometers(6)))
.withFareDistance(
new LinearDistance(
Distance.ofKilometersBoxed(3d, ignore -> {}).orElse(null),
Distance.ofKilometersBoxed(6d, ignore -> {}).orElse(null)
)
)
.build(),
FareLegRule
.of(DISTANCE_ID, twoKmProduct)
.withFareDistance(new LinearDistance(Distance.ofMeters(0), Distance.ofMeters(2000)))
.withFareDistance(
new LinearDistance(
Distance.ofMetersBoxed(0d, ignore -> {}).orElse(null),
Distance.ofMetersBoxed(2000d, ignore -> {}).orElse(null)
)
)
.build()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ void calculateFareThatIncludesNoFreeTransfers() {
);
calculateFare(rides, FareType.youth, Money.ZERO_USD);
// We don't get any fares for the skagit transit leg below here because they don't accept ORCA (electronic)
calculateFare(rides, FareType.electronicSpecial, ONE_DOLLAR.plus(ONE_DOLLAR).plus(DEFAULT_TEST_RIDE_PRICE.times(2)));
calculateFare(
rides,
FareType.electronicRegular,
DEFAULT_TEST_RIDE_PRICE.times(4)
FareType.electronicSpecial,
ONE_DOLLAR.plus(ONE_DOLLAR).plus(DEFAULT_TEST_RIDE_PRICE.times(2))
);
calculateFare(rides, FareType.electronicRegular, DEFAULT_TEST_RIDE_PRICE.times(4));
calculateFare(
rides,
FareType.electronicSenior,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.opentripplanner.model.plan.Itinerary;
import org.opentripplanner.routing.api.RoutingService;
import org.opentripplanner.routing.api.request.RouteRequest;
import org.opentripplanner.routing.api.request.StreetMode;
import org.opentripplanner.routing.api.request.framework.TimeAndCostPenalty;
import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter;
import org.opentripplanner.routing.graph.Graph;
Expand Down Expand Up @@ -237,12 +238,16 @@ private static List<Itinerary> getItineraries(
);

var modes = request.journey().modes().copyOf();
modes.withEgressMode(FLEXIBLE);

if (onlyDirect) {
modes.withDirectMode(FLEXIBLE);
request.journey().transit().setFilters(List.of(ExcludeAllTransitFilter.of()));
modes
.withDirectMode(FLEXIBLE)
.withAccessMode(StreetMode.WALK)
.withEgressMode(StreetMode.WALK);
request.journey().transit().setFilters(List.of(AllowAllTransitFilter.of()));
request.journey().transit().disable();
} else {
modes.withEgressMode(FLEXIBLE);
request.journey().transit().setFilters(List.of(AllowAllTransitFilter.of()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,4 @@ public static StopTime regularStop(int arrivalTime, int departureTime) {
stopTime.setTrip(TRIP);
return stopTime;
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.opentripplanner.ext.flex.filter;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;

import java.util.List;
import java.util.Set;
import org.junit.jupiter.api.Test;
import org.opentripplanner.ext.flex.filter.FlexTripFilterRequest.Filter;
import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter;
import org.opentripplanner.routing.api.request.request.filter.SelectRequest;
import org.opentripplanner.routing.api.request.request.filter.TransitFilterRequest;

class FilterMapperTest {

@Test
void allowAll() {
var filter = FilterMapper.mapFilters(List.of(AllowAllTransitFilter.of()));
assertEquals(FlexTripFilter.ALLOW_ALL, filter);
}

@Test
void distinct() {
var filter = FilterMapper.mapFilters(
List.of(AllowAllTransitFilter.of(), AllowAllTransitFilter.of())
);
assertEquals(FlexTripFilter.ALLOW_ALL, filter);
}

@Test
void routes() {
var select = SelectRequest.of().withRoutes(List.of(id("r1"))).build();
var transitFilter = TransitFilterRequest.of().addSelect(select).addNot(select).build();
var filter = FilterMapper.mapFilters(List.of(transitFilter));
assertEquals(
new FlexTripFilter(
List.of(new Filter(Set.of(), Set.of(), Set.of(id("r1")), Set.of(id("r1"))))
),
filter
);
}

@Test
void agencies() {
var select = SelectRequest.of().withAgencies(List.of(id("a1"))).build();
var transitFilter = TransitFilterRequest.of().addSelect(select).addNot(select).build();
var filter = FilterMapper.mapFilters(List.of(transitFilter));
assertEquals(
new FlexTripFilter(
List.of(new Filter(Set.of(id("a1")), Set.of(id("a1")), Set.of(), Set.of()))
),
filter
);
}
}
Loading
Loading