-
Notifications
You must be signed in to change notification settings - Fork 45
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
editoast: explanation of why a simulation is not feasible refactor editoast #9434
editoast: explanation of why a simulation is not feasible refactor editoast #9434
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #9434 +/- ##
=============================================
+ Coverage 39.62% 87.49% +47.86%
=============================================
Files 1300 31 -1269
Lines 99167 1535 -97632
Branches 3283 0 -3283
=============================================
- Hits 39297 1343 -37954
+ Misses 57937 192 -57745
+ Partials 1933 0 -1933
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
90fd83e
to
3fcc0f0
Compare
3012e7b
to
4ecb4de
Compare
4ecb4de
to
a19b328
Compare
3fcc0f0
to
23c11f4
Compare
23c11f4
to
217365c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work, it's going into the right direction I believe. I'm not sure that I understand the first commit ❓Thank you for the separation and description of the other commits.
I believe we can continue on this track of isolating part of the STDCM flow, but there is already enough in the current PR so probably for later.
#[serde(tag = "status", rename_all = "snake_case")] | ||
// We accepted the difference of memory size taken by variants | ||
// Since there is only on success and others are error cases | ||
#[allow(clippy::large_enum_variant)] | ||
pub enum STDCMResponse { | ||
pub enum STDCMCoreResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I understand the renaming. This struct
is defined inside a module name core
so we already know it's relative to core's logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed it to avoid conflicts and as
, since we have another STDCMResponse
in views
, and both are used in the same file.
) | ||
.await?; | ||
|
||
let simulation_run_time = match virtual_train_sim_result.clone().simulation_run_time() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not believe you need to .clone()
here.
let simulation_run_time = match virtual_train_sim_result.clone().simulation_run_time() { | |
let simulation_run_time = match virtual_train_sim_result.simulation_run_time() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it afterwards in PathNotFoundHandler
.
editoast/src/views/timetable.rs
Outdated
} | ||
} | ||
|
||
fn elapsed_since_time_ms(time: &NaiveDateTime, zero: &DateTime<Utc>) -> u64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zero
means 0 in my mind. Maybe we can find another name? How about since
(because it's in the name of the function)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it by start_time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it by start_time
editoast/src/views/timetable.rs
Outdated
@@ -351,6 +359,29 @@ async fn conflicts( | |||
Ok(Json(conflict_detection_response.conflicts)) | |||
} | |||
|
|||
pub fn filter_core_work_schedule( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this function be in an impl WorkSchedule
? I'm really asking the question because you might have a better understanding than me if it makes sense or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. (it was renamed by map_to_core_work_schedule
)
374a154
to
0eb6401
Compare
Signed-off-by: hamz2a <atrari.hamza@gmail.com>
Signed-off-by: hamz2a <atrari.hamza@gmail.com>
- Moved utility functions `get_earliest_step_time`, `get_earliest_step_tolerance_window`, `get_total_stop_time`, `get_maximum_departure_delay`, `get_earliest_departure_time` and `get_latest_simulation_end` into the `STDCMRequestPayload` struct as methods. - Updated the `stdcm` function to utilize these new methods for better readability and maintainability. - Removed redundant function definitions and improved code organization. Signed-off-by: hamz2a <atrari.hamza@gmail.com>
Signed-off-by: hamz2a <atrari.hamza@gmail.com>
Signed-off-by: hamz2a <atrari.hamza@gmail.com>
Signed-off-by: hamz2a <atrari.hamza@gmail.com>
0eb6401
to
0f81762
Compare
Work has been moved into #9509 (just because of some git shenanigans!) |
closes #9476
Refactor error handling and method organization
STDCMResponse::PathNotFound
error is handled.STDCMRequestPayload
methods for better structure.simulation_run_time
toSimulationResponse
for clarity.