Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenFisca-JSON-Model
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
Adaptations OpenFisca
OpenFisca-JSON-Model
Commits
a4984686
Commit
a4984686
authored
10 months ago
by
Emmanuel Raviart
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/tools/src/scripts/customize_variables.ts
+22
-10
22 additions, 10 deletions
packages/tools/src/scripts/customize_variables.ts
with
22 additions
and
10 deletions
packages/tools/src/scripts/customize_variables.ts
+
22
−
10
View file @
a4984686
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment