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

front: fix power restrictions reset when editing a train #10134

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

clarani
Copy link
Contributor

@clarani clarani commented Dec 19, 2024

closes #9902

To test:

  • create a train with power restrictions
  • try to edit it
  • its power restrictions are not reset

@clarani clarani requested a review from a team as a code owner December 19, 2024 13:39
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Dec 19, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 79.81%. Comparing base (465d3d1) to head (fb011a4).
Report is 26 commits behind head on dev.

Files with missing lines Patch % Lines
...nt/src/modules/pathfinding/hooks/usePathfinding.ts 0.00% 10 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10134      +/-   ##
==========================================
- Coverage   79.83%   79.81%   -0.02%     
==========================================
  Files        1054     1054              
  Lines      105547   105537      -10     
  Branches      726      726              
==========================================
- Hits        84261    84237      -24     
- Misses      21244    21258      +14     
  Partials       42       42              
Flag Coverage Δ
editoast 73.71% <ø> (-0.04%) ⬇️
front 89.13% <0.00%> (-0.02%) ⬇️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 87.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@clarani clarani force-pushed the cni/9902-fix-power-restrictions branch from d559bd8 to cb3ecb6 Compare December 19, 2024 13:42
Add a state value isInitialized to avoid reseting the power restrictions when editing a train.
Indeed, the pathfinding was launched by the 2 hooks (with infra and rollingStock), which reset the power restrictions,
even when the user was editing a train. Now it won't be the case anymore.

Signed-off-by: Clara Ni <clara.ni@outlook.fr>
@clarani clarani force-pushed the cni/9902-fix-power-restrictions branch from cb3ecb6 to fb011a4 Compare December 19, 2024 14:46
@clarani clarani requested review from kmer2016 and Akctarus December 19, 2024 14:46
@clarani clarani enabled auto-merge December 20, 2024 09:45
Copy link
Contributor

@Akctarus Akctarus left a comment

Choose a reason for hiding this comment

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

Tested, LGTM, ty for this fix.
Also I have a question, not directly linked to this PR, do you know if this is the expected behavior when places where power restrictions are cut create vias?

@clarani
Copy link
Contributor Author

clarani commented Dec 23, 2024

Thanks @Akctarus ! Yes, it is the expected behavior for now, because to add power restriction in the backend, we need to locate them with pathsteps ids ;)

Copy link
Contributor

@kmer2016 kmer2016 left a comment

Choose a reason for hiding this comment

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

LGTM

@clarani clarani added this pull request to the merge queue Dec 23, 2024
Merged via the queue into dev with commit 2b22d28 Dec 23, 2024
27 checks passed
@clarani clarani deleted the cni/9902-fix-power-restrictions branch December 23, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

front: editing a train with power restrictions resets its power restrictions
4 participants