Skip to content
Snippets Groups Projects
Commit a4984686 authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Add customization.main_parameters to every formulas instead of only the latest

parent f47d20e7
No related branches found
No related tags found
No related merge requests found
......@@ -144,18 +144,30 @@ async function main() {
}
}
if (customization.main_parameters !== undefined) {
const latest_formula = Object.entries(variable.formulas ?? {}).sort(
([date1], [date2]) => date2.localeCompare(date1),
)[0][1]
if (latest_formula !== null) {
latest_formula.parameters = [
// In theory only the latest formula should be updated with customization.main_parameters.
// but sometimes, the latest formula is for next year and the UI will use the formula before
// const latest_formula = Object.entries(variable.formulas ?? {}).sort(
// ([date1], [date2]) => date2.localeCompare(date1),
// )[0][1]
// if (latest_formula !== null) {
// latest_formula.parameters = [
// ...new Set([
// ...customization.main_parameters,
// ...(latest_formula.parameters ?? []).sort(),
// ]),
// ]
// }
for (const formula of Object.values(variable.formulas ?? {})) {
if (formula !== null) {
formula.parameters = [
...new Set([
...customization.main_parameters,
...(latest_formula.parameters ?? []).sort(),
...(formula.parameters ?? []).sort(),
]),
]
}
}
}
if (customization.obsolete) {
variable.obsolete = true
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment