Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
leximpact-socio-fiscal-ui
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
leximpact-socio-fiscal-ui
Commits
dac766b7
Commit
dac766b7
authored
May 17, 2022
by
Emmanuel Raviart
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused code.
parent
64052900
No related branches found
No related tags found
1 merge request
!87
Resolve "Faire apparaître les revenus du capital et de rente et RSA dans les étiquettes cas types"
Pipeline
#3873
passed
May 17, 2022
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/components/test_cases/TestCaseCompareView.svelte
+1
-111
1 addition, 111 deletions
src/lib/components/test_cases/TestCaseCompareView.svelte
src/lib/components/test_cases/TestCaseSummary.svelte
+0
-14
0 additions, 14 deletions
src/lib/components/test_cases/TestCaseSummary.svelte
with
1 addition
and
125 deletions
src/lib/components/test_cases/TestCaseCompareView.svelte
+
1
−
111
View file @
dac766b7
<script
lang=
"ts"
>
import
type
{
DecompositionReference
,
Variable
,
Waterfall
,
}
from
"
@openfisca/json-model
"
import
type
{
DecompositionReference
,
Waterfall
}
from
"
@openfisca/json-model
"
import
{
Unit
}
from
"
@openfisca/json-model
"
import
{
createEventDispatcher
,
getContext
}
from
"
svelte
"
import
type
{
Writable
}
from
"
svelte/store
"
import
{
session
}
from
"
$app/stores
"
import
type
{
CalculationByName
,
CalculationName
}
from
"
$lib/calculations
"
// import PictoArbreMetropole from "$lib/components/pictos/PictoArbreMetropole.svelte"
import
Icon
from
"
@iconify/svelte
"
import
Spinner
from
"
$lib/components/Spinner.svelte
"
import
TestCaseSummary
from
"
$lib/components/test_cases/TestCaseSummary.svelte
"
...
...
@@ -25,10 +20,6 @@
import
{
entityByKey
,
personEntityKey
}
from
"
$lib/entities
"
import
type
{
ParametricReform
}
from
"
$lib/reforms
"
import
type
{
Situation
,
Slider
}
from
"
$lib/situations
"
import
{
getSituationVariableValue
,
setSituationVariableValue
,
}
from
"
$lib/situations
"
import
{
variableSummaryByName
}
from
"
$lib/variables
"
export
let
decompositionByName
:
DecompositionByName
...
...
@@ -42,12 +33,6 @@
)
as
Writable
<
CalculationByName
>
const
childrenKey
=
$session
.
childrenKey
const
dispatch
=
createEventDispatcher
()
const
euroAmountFormatter
=
new
Intl
.
NumberFormat
(
"
fr-FR
"
,
{
currency
:
"
EUR
"
,
maximumFractionDigits
:
0
,
minimumFractionDigits
:
0
,
style
:
"
currency
"
,
})
const
evaluationByNameArray
=
getContext
(
"
evaluationByNameArray
"
)
as
Writable
<
EvaluationByName
[]
>
...
...
@@ -95,8 +80,6 @@
:
situationsToCompare
[
situationIndex
][
sliderEntity
.
key_plural
],
)
// $: updateSituation(year, adultes, enfants)
function
calculateTotal
(
evaluationByName
:
EvaluationByName
,
calculationName
:
CalculationName
,
...
...
@@ -124,102 +107,9 @@
return
total
}
function
changeVectorIndex
(
index
:
number
,
situationIndex
:
number
,
event
:
Event
,
)
{
const
target
=
event
.
target
as
HTMLInputElement
const
vectorIndex
=
parseInt
(
target
.
value
)
// Update situation.
let
situation
=
situationsToCompare
[
index
]
const
slider
=
situation
.
slider
const
variable
=
variableSummaryByName
[
slider
.
name
]
const
updatedSituation
=
setSituationVariableValue
(
entityByKey
,
situation
,
variable
,
slider
.
id
,
year
,
Math
.
round
(
slider
.
stepValue
*
vectorIndex
),
)
updatedSituation
.
slider
=
{
...
slider
,
vectorIndex
,
}
situation
=
updatedSituation
situationsToCompare
[
index
]
=
situation
dispatch
(
"
changeSituation
"
,
{
situation
,
situationIndex
})
}
function
changeWaterfall
(
waterfallName
:
string
)
{
$waterfall
=
waterfalls
.
find
(({
name
})
=>
name
===
waterfallName
)
}
function
getVariableValue
(
situation
:
Situation
,
variableName
:
string
,
populationId
:
string
,
):
number
|
undefined
{
const
variable
=
variableSummaryByName
[
variableName
]
if
(
variable
===
undefined
)
{
return
undefined
}
return
getSituationVariableValue
(
situation
,
variable
,
populationId
,
year
,
)
as
number
}
function
toggleSlider
(
situationIndex
:
number
,
situation
:
Situation
,
variable
:
Variable
,
)
{
if
(
situation
.
slider
===
undefined
)
{
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const
slider
=
situation
.
sliders
!
.
find
(
(
slider
)
=>
slider
.
entity
===
variable
.
entity
&&
slider
.
name
===
variable
.
name
,
)
const
stepValue
=
(
slider
.
max
-
slider
.
min
)
/
100
const
value
=
getSituationVariableValue
(
situation
,
variable
,
slider
.
id
,
year
,
)
as
number
const
vectorIndex
=
Math
.
max
(
0
,
Math
.
min
(
100
,
Math
.
round
(
value
/
stepValue
)),
)
let
updatedSituation
=
setSituationVariableValue
(
entityByKey
,
situation
,
variable
,
slider
.
id
,
year
,
Math
.
round
(
stepValue
*
vectorIndex
),
)
if
(
updatedSituation
===
situation
)
{
// This can occur, when slider was deselected, then reselected.
updatedSituation
=
{
...
situation
}
}
updatedSituation
.
slider
=
{
...
slider
,
stepValue
,
vectorIndex
,
}
situation
=
updatedSituation
}
else
{
situation
=
{
...
situation
}
delete
situation
.
slider
}
dispatch
(
"
changeSituation
"
,
{
situationIndex
,
situation
})
}
</script>
<div
...
...
This diff is collapsed.
Click to expand it.
src/lib/components/test_cases/TestCaseSummary.svelte
+
0
−
14
View file @
dac766b7
...
...
@@ -57,26 +57,12 @@
[],
)
$
:
childrenCount
=
Object
.
values
(
familySituation
).
reduce
(
(
count
:
number
,
family
)
=>
count
+
((
family
[
childrenKey
]
as
string
[]
|
undefined
)?.
length
??
0
),
0
,
)
$
:
personSituation
=
situation
[
personEntity
.
key_plural
]
$
:
personsCount
=
Object
.
keys
(
personSituation
).
length
$
:
adultsCount
=
personsCount
-
childrenCount
$
:
slider
=
situation
.
sliders
?.[
0
]
$
:
sliderEntity
=
slider
===
undefined
?
undefined
:
entityByKey
[
slider
.
entity
]
$
:
sliderEntitySituation
=
sliderEntity
===
undefined
?
undefined
:
situation
[
sliderEntity
.
key_plural
]
function
changeVectorIndex
(
event
:
Event
)
{
const
target
=
event
.
target
as
HTMLInputElement
const
vectorIndex
=
parseInt
(
target
.
value
)
...
...
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