From d602c6a648878c1a3e84f1c768f1a976eeebc288 Mon Sep 17 00:00:00 2001 From: Toufic Batache <taffou2a@gmail.com> Date: Thu, 18 Jan 2024 10:58:55 +0100 Subject: [PATCH] Fix cache cas type --- src/routes/+layout.svelte | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index cd2b00fa2..ed34a0ab6 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -410,12 +410,30 @@ situationIndexByCalculationName: RequestedSituationIndexByCalculationName, ) { const aggregatedSituation: SituationWithAxes = {} + const axesData: { situationIndex: number; variables: string[] } = + $axes.reduce( + ( + result: { situationIndex?: number; variables: string[] }, + parallelAxes, + ) => { + for (const axis of parallelAxes) { + result.situationIndex = axis.situationIndex + if (result.variables.includes(axis.name)) { + continue + } + result.variables.push(axis.name) + } + return result + }, + { variables: [] }, + ) const entities = Object.values(entityByKey) if ( Object.values(situationIndexByCalculationName).some( (situationIndex) => situationIndex === null, ) ) { + let personIndex = -1 // Some of the calculations are requested to be done for every situations. // Aggregate every situations into a single one without calculated variables. for (const [situationIndex, situation] of $testCases.entries()) { @@ -454,11 +472,18 @@ (personId) => situationPrefix + personId, ) } + } else { + personIndex++ } for (const [variableName, variableValueByInstant] of Object.entries( population, )) { - if (reservedKeys.has(variableName)) { + if ( + reservedKeys.has(variableName) || + (entity.is_person && + axesData.situationIndex === personIndex && + axesData.variables.includes(variableName)) + ) { continue } const inputVariableValueByInstant: { -- GitLab