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

Add support for park and ride itineraries when calculating CO2 emissions #5489

Merged
merged 10 commits into from
Nov 13, 2023

Conversation

sharhio
Copy link
Contributor

@sharhio sharhio commented Nov 7, 2023

Summary

Park and ride journeys taken into account in CO2 emission calculations:

  • When itinerary contains both street legs and transit legs and emissions are calculated for transit legs, CO2 emission calculation combines transit journey and car journey emissions.
  • When itinerary contains both street legs and transit legs, but emissions are not calculated for transit legs, no CO2 value is returned.

Issue

Park and ride journeys receive results based on the car journey alone.

Unit tests

Tests added in file EmissionsServiceTest.java
Tests for:

  • Getting results that combine transitLeg and streetLeg CO2 emissions.
  • Not getting results for itineraries with routes that are missing CO2 emission data, but also contain streetLegs.

Manual testing was also performed.

@sharhio sharhio requested a review from a team as a code owner November 7, 2023 13:57
@leonardehrenfried
Copy link
Member

Please run the formatter.

Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (37a8367) 66.85% compared to head (112e9ad) 66.85%.

Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #5489   +/-   ##
==========================================
  Coverage      66.85%   66.85%           
- Complexity     15650    15655    +5     
==========================================
  Files           1817     1817           
  Lines          70158    70160    +2     
  Branches        7379     7383    +4     
==========================================
+ Hits           46902    46904    +2     
  Misses         20798    20798           
  Partials        2458     2458           
Files Coverage Δ
...opentripplanner/ext/emissions/EmissionsFilter.java 94.00% <90.00%> (-1.84%) ⬇️

... and 1 file with indirect coverage changes

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

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

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

Please have a look at my comments.

@leonardehrenfried
Copy link
Member

Please resolve the conflicts.

@sharhio sharhio requested a review from optionsome November 13, 2023 10:29
@optionsome optionsome merged commit 583e847 into opentripplanner:dev-2.x Nov 13, 2023
5 checks passed
@optionsome optionsome deleted the co2 branch November 13, 2023 10:45
@t2gran t2gran added this to the 2.5 (next release) milestone Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants