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 step update erasing parts of the study in studies page #10382

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

Synar
Copy link
Contributor

@Synar Synar commented Jan 14, 2025

Close #6455

I believe the issue came from the fact editoast does not properly handles a partial studyForm, as the attributes are nullable and editoast does not seem to distinguish between an undefined attribute and a null one. The study changeset is indeed option<option>, but the studyForm is simply option. I am unsure if we can handle this better, considering the limitations of open api and type conversions between js and rust.

In the meantime, we now send the full study everytime.

Also fix a couple inconsistent translations in study dates

Edit : patches now properly handled in editoast thanks to serde with double option, we only send partial study patches again

Synar added 3 commits January 14, 2025 18:14
…partial erasure

Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
… as finished in study page

Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
@Synar Synar requested a review from a team as a code owner January 14, 2025 17:38
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Jan 14, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2025

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

Codecov Report

Attention: Patch coverage is 96.77419% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.77%. Comparing base (ddc52f5) to head (0cf05aa).
Report is 48 commits behind head on dev.

Files with missing lines Patch % Lines
editoast/src/views/projects.rs 83.33% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10382      +/-   ##
==========================================
+ Coverage   81.65%   81.77%   +0.12%     
==========================================
  Files        1066     1073       +7     
  Lines      105692   106531     +839     
  Branches      727      727              
==========================================
+ Hits        86302    87119     +817     
- Misses      19349    19373      +24     
+ Partials       41       39       -2     
Flag Coverage Δ
editoast 74.16% <92.85%> (+0.45%) ⬆️
front 89.36% <100.00%> (+0.03%) ⬆️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 87.05% <ø> (ø)

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.

@@ -4,10 +4,10 @@
"createScenario": "Create a scenario",
"dates": {
"creation": "Creation",
"estimatedend": "Expected ending",
Copy link
Contributor

Choose a reason for hiding this comment

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

estimatedEnd for readability ? 😄
or maybe it should be expectedEnd ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, lets go with expectedEnd ^^

…ject using serde with double option

Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
@Synar Synar requested a review from a team as a code owner January 15, 2025 22:01
@github-actions github-actions bot added the area:editoast Work on Editoast Service label Jan 15, 2025
Copy link
Contributor

@woshilapin woshilapin left a comment

Choose a reason for hiding this comment

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

Great improvement for editoast form's. We should actually bring that to other forms now that we know 😄.

I actually tested a PUT on /studies with {"description":"something"}, then with {"study_type":"something"} (checking that description has not been erased in the process) and it works well. Then finally with {"description":null} which works also as expected.

Copy link
Contributor

@hamz2a hamz2a left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@leovalais
Copy link
Contributor

We should actually bring that to other forms now that we know 😄

That's actually quite a lot of them 😨

I came to really dislike the flat_* functions of the changeset. I'd rather have something like MaybeUnset<T> which could also be used by API forms (much like what SeaORM does with it's ActiveRecords 👀). Anyway it has to be refined and it's for another PR, thanks for the fix!

@Synar Synar requested a review from a team as a code owner January 17, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:editoast Work on Editoast Service area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing study status erases starting/expected ending/real ending dates
6 participants