Skip to content

Commit

Permalink
editoast: fix pr comments
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Berezovskiy <egor@berezify.fr>
  • Loading branch information
Wadjetz committed Nov 8, 2024
1 parent c205a2a commit 6f68ddc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions editoast/src/core/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,12 @@ impl PhysicsConsistParameters {
}

pub fn compute_max_speed(&self) -> f64 {
match self.max_speed {
Some(0.0) => self.traction_engine.max_speed,
Some(max_speed_parameter) => {
self.max_speed
.filter(|max_speed_parameter| *max_speed_parameter != 0.0)
.map(|max_speed_parameter| {
f64::min(self.traction_engine.max_speed, max_speed_parameter)
}
None => self.traction_engine.max_speed,
}
})
.unwrap_or(self.traction_engine.max_speed)
}

pub fn compute_startup_acceleration(&self) -> f64 {
Expand Down
6 changes: 3 additions & 3 deletions editoast/src/views/timetable/stdcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ pub struct STDCMRequestPayload {
#[schema(value_type = Option<String>, example = json!(["5%", "2min/100km"]))]
margin: Option<MarginValue>,
/// Total mass of the consist in kg
#[validate(range(min = 1.0))]
#[validate(range(exclusive_min = 0.0))]
total_mass: Option<f64>,
/// Total length of the consist in meters
#[validate(range(min = 1.0))]
#[validate(range(exclusive_min = 0.0))]
total_length: Option<f64>,
/// Maximum speed of the consist in km/h
#[validate(range(min = 1.0))]
#[validate(range(exclusive_min = 0.0))]
max_speed: Option<f64>,
loading_gauge_type: Option<LoadingGaugeType>,
}
Expand Down

0 comments on commit 6f68ddc

Please sign in to comment.