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

[Jormungandr] Fix LEZ when fallbacks are car #3969

Merged
merged 3 commits into from
Apr 6, 2023

Conversation

xlqian
Copy link
Member

@xlqian xlqian commented Apr 6, 2023

In this PR, two cases are fixed:

  • at least one of the fallbacks traverses LEZ, we set on_path to true for the whole journey :
    image

  • none of the fallbacks traverses LEZ, we set on_path to false for the whole journey:
    image

@xlqian xlqian requested review from woshilapin, azime and pbench April 6, 2023 13:46
Comment on lines +117 to +132
tmp_list = [
not section.low_emission_zone.on_path
for section in journey.sections
if section.HasField('low_emission_zone')
]
# all([]) == True it's not what we want :(
if tmp_list and all(tmp_list):
journey.low_emission_zone.on_path = False
elif any(
section.low_emission_zone.on_path
for section in journey.sections
if section.HasField('low_emission_zone')
):
journey.low_emission_zone.on_path = True


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
tmp_list = [
not section.low_emission_zone.on_path
for section in journey.sections
if section.HasField('low_emission_zone')
]
# all([]) == True it's not what we want :(
if tmp_list and all(tmp_list):
journey.low_emission_zone.on_path = False
elif any(
section.low_emission_zone.on_path
for section in journey.sections
if section.HasField('low_emission_zone')
):
journey.low_emission_zone.on_path = True
for section in journey.sections:
if section.HasField('low_emission_zone'):
if section.low_emission_zone.on_path:
journey.low_emission_zone.on_path = True
break

Copy link
Member Author

Choose a reason for hiding this comment

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

it won't work if none of the fallbacks has LEZ...

Copy link
Member Author

@xlqian xlqian Apr 6, 2023

Choose a reason for hiding this comment

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

and for the sake of compatibility, we don't display low_emission_zone.on_path if the information of LEZ is unavailable...

@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@xlqian xlqian merged commit 178c7e2 into dev Apr 6, 2023
@xlqian xlqian deleted the fix_zfe_when_fallback_is_car branch April 6, 2023 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants