diff --git a/editoast/openapi.yaml b/editoast/openapi.yaml index fec78f868ce..f4370672f89 100644 --- a/editoast/openapi.yaml +++ b/editoast/openapi.yaml @@ -4961,6 +4961,14 @@ components: ProjectPathInput: description: Project path input is described by a list of routes and a list of track range properties: + blocks: + description: Path description as block ids + items: + maxLength: 255 + minLength: 1 + type: string + minItems: 1 + type: array routes: description: List of route ids items: @@ -4976,8 +4984,9 @@ components: minItems: 1 type: array required: - - routes - track_section_ranges + - routes + - blocks type: object ProjectPathTrainResult: allOf: diff --git a/editoast/src/core/v2/signal_updates.rs b/editoast/src/core/v2/signal_updates.rs index 929e4d5d0d1..e0bcf9bb1e1 100644 --- a/editoast/src/core/v2/signal_updates.rs +++ b/editoast/src/core/v2/signal_updates.rs @@ -20,6 +20,8 @@ pub struct SignalUpdatesRequest<'a> { pub track_section_ranges: &'a Vec, /// Path description as route ids pub routes: &'a Vec, + /// Path description as block ids + pub blocks: &'a Vec, /// List of signal sightings and zone updates for each train pub train_simulations: HashMap>, } diff --git a/editoast/src/views/v2/train_schedule/projection.rs b/editoast/src/views/v2/train_schedule/projection.rs index b5ee9ef7d17..ef5d4baf5d2 100644 --- a/editoast/src/views/v2/train_schedule/projection.rs +++ b/editoast/src/views/v2/train_schedule/projection.rs @@ -59,12 +59,15 @@ crate::routes! { /// Project path input is described by a list of routes and a list of track range #[derive(Debug, Deserialize, Serialize, ToSchema)] struct ProjectPathInput { - /// List of route ids - #[schema(inline, min_items = 1)] - routes: Vec, /// List of track ranges #[schema(min_items = 1)] track_section_ranges: Vec, + /// List of route ids + #[schema(inline, min_items = 1)] + routes: Vec, + /// Path description as block ids + #[schema(inline, min_items = 1)] + blocks: Vec, } #[derive(Debug, Clone, Deserialize, Serialize, ToSchema)] @@ -128,6 +131,7 @@ async fn project_path( let ProjectPathInput { track_section_ranges: path_track_ranges, routes: path_routes, + blocks: path_blocks, } = data.into_inner(); let path_projection = PathProjection::new(&path_track_ranges); let query_props = params.into_inner(); @@ -208,6 +212,7 @@ async fn project_path( &train_details, &path_track_ranges, &path_routes, + &path_blocks, ); let projection: Option = redis_conn .json_get_ex(&hash, CACHE_PROJECTION_EXPIRATION) @@ -232,6 +237,7 @@ async fn project_path( &infra, &path_track_ranges, &path_routes, + &path_blocks, &miss_cache ) ); @@ -245,6 +251,7 @@ async fn project_path( &train_details, &path_track_ranges, &path_routes, + &path_blocks, ); let cached = CachedProjectPathTrainResult { space_time_curves: space_time_curves @@ -308,15 +315,17 @@ struct TrainSimulationDetails { async fn compute_batch_signal_updates<'a>( core: Arc, infra: &Infra, - track_section_ranges: &'a Vec, - routes: &'a Vec, + path_track_ranges: &'a Vec, + path_routes: &'a Vec, + path_blocks: &'a Vec, trains_details: &'a HashMap, ) -> Result>> { let request = SignalUpdatesRequest { infra: infra.id, expected_version: infra.version.clone(), - track_section_ranges, - routes, + track_section_ranges: path_track_ranges, + routes: path_routes, + blocks: path_blocks, train_simulations: trains_details .iter() .map(|(id, details)| { @@ -489,12 +498,14 @@ fn train_projection_input_hash( project_path_input: &TrainSimulationDetails, path_projection_tracks: &[TrackRange], path_routes: &[Identifier], + path_blocks: &[Identifier], ) -> String { let osrd_version = get_app_version().unwrap_or_default(); let mut hasher = DefaultHasher::new(); project_path_input.hash(&mut hasher); path_projection_tracks.hash(&mut hasher); path_routes.hash(&mut hasher); + path_blocks.hash(&mut hasher); let hash_simulation_input = hasher.finish(); format!("projection_{osrd_version}.{infra_id}.{infra_version}.{hash_simulation_input}") } diff --git a/front/src/common/api/osrdEditoastApi.ts b/front/src/common/api/osrdEditoastApi.ts index 93c81983975..f3954ddb923 100644 --- a/front/src/common/api/osrdEditoastApi.ts +++ b/front/src/common/api/osrdEditoastApi.ts @@ -3300,6 +3300,8 @@ export type ProjectPathTrainResult = { rolling_stock_length: number; }; export type ProjectPathInput = { + /** Path description as block ids */ + blocks: string[]; /** List of route ids */ routes: string[]; /** List of track ranges */