Skip to content
Snippets Groups Projects
Commit f06cfb65 authored by Toufic Batache's avatar Toufic Batache Committed by Emmanuel Raviart
Browse files

Replace sendTestCasesSimulation() map with for loop

parent 8b5225cc
No related branches found
No related tags found
1 merge request!273Passage à Svelte 5
...@@ -751,16 +751,13 @@ async function sendTestCasesSimulation( ...@@ -751,16 +751,13 @@ async function sendTestCasesSimulation(
// Split evaluation.value vector for each situation. // Split evaluation.value vector for each situation.
{ {
let testCasesPopulationIndex = 0 let testCasesPopulationIndex = 0
valuesByCalculationNameByVariableNameArray = for (const [
valuesByCalculationNameByVariableNameArray.map(
(
valuesByCalculationNameByVariableName,
situationIndex, situationIndex,
): ValuesByCalculationNameByVariableName => { valuesByCalculationNameByVariableName,
] of valuesByCalculationNameByVariableNameArray.entries()) {
const situation = shared.testCases[situationIndex] const situation = shared.testCases[situationIndex]
const entitySituation = const entitySituation = situation[entity.key_plural as string] ?? {}
situation[entity.key_plural as string] ?? {} const values: VariableValues = []
let values = []
for ( for (
let index = testCasesPopulationIndex, vectorIndex = 0; let index = testCasesPopulationIndex, vectorIndex = 0;
vectorIndex < shared.vectorLength; vectorIndex < shared.vectorLength;
...@@ -773,17 +770,10 @@ async function sendTestCasesSimulation( ...@@ -773,17 +770,10 @@ async function sendTestCasesSimulation(
} }
} }
testCasesPopulationIndex += Object.keys(entitySituation).length testCasesPopulationIndex += Object.keys(entitySituation).length
const valuesByCalculationName = ;(valuesByCalculationNameByVariableName[variableName] ??= {})[
valuesByCalculationNameByVariableName[variableName] ?? {} calculationName
return { ] = values
...valuesByCalculationNameByVariableName,
[variableName]: {
...valuesByCalculationName,
[calculationName]: values,
},
} }
},
)
} }
} else { } else {
// Variable has been computed for a single test case. // Variable has been computed for a single test case.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment