Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • 19-mettre-a-jour-la-df-pour-2025
  • debug-populations-initiales-garanties
  • 2-echec-du-deploiement-en-ci-au-tagging
  • Dorine-master-patch-01871
  • update-to-2023
  • plf-2023
  • loi-2022
  • 4.3.0
  • 4.2.0
  • 4.1.1
  • 4.1.0
  • 4.0.0
  • 3.0.2
  • 3.0.0
  • 2.0.2
  • 2.0.1
  • 2.0.0
  • 1.0.0
  • 0.9.0
  • 0.8.1
  • 0.8.0
  • 0.7.7
  • 0.7.4
  • 0.7.5
  • 0.7.3
  • 0.7.2
  • 0.7.1
28 results

analyse_dotations.ipynb

Blame
  • TestCaseCompareView.svelte 15.04 KiB
    <script lang="ts">
      import Icon from "@iconify/svelte"
      import {
        type DecompositionReference,
        Unit,
        type Waterfall,
      } from "@openfisca/json-model"
      import { createEventDispatcher, getContext } from "svelte"
      import type { Writable } from "svelte/store"
    
      import type { CalculationByName, CalculationName } from "$lib/calculations"
      import Spinner from "$lib/components/Spinner.svelte"
      import TestCaseSummary from "$lib/components/test_cases/TestCaseSummary.svelte"
      import ValueChangeCompare from "$lib/components/ValueChangeCompare.svelte"
      import WaterfallCompareView from "$lib/components/WaterfallCompareView.svelte"
      import {
        type DecompositionByName,
        type EvaluationByName,
        waterfalls,
      } from "$lib/decompositions"
      import type { DisplayMode } from "$lib/displays"
      import type { ParametricReform } from "$lib/reforms"
      import type { Situation } from "$lib/situations"
      import { newSimulationUrl } from "$lib/urls"
      import {
        type ValuesByCalculationNameByVariableName,
        variableSummaryByName,
      } from "$lib/variables"
    
      export let decompositionByName: DecompositionByName
      export let displayMode: DisplayMode
      export let situationsToCompareIndex: number[]
      export let year: number
    
      const billName = getContext("billName") as Writable<string | undefined>
      const calculationByName = getContext(
        "calculationByName",
      ) as Writable<CalculationByName>
      const dispatch = createEventDispatcher()
      const evaluationByNameArray = getContext("evaluationByNameArray") as Writable<
        EvaluationByName[]
      >
      const parametricReform = getContext(
        "parametricReform",
      ) as Writable<ParametricReform>
      const testCases = getContext("testCases") as Writable<Situation[]>
      const testCasesIndex = getContext("testCasesIndex") as Writable<number[]>
      const valuesByCalculationNameByVariableNameArray = getContext(
        "valuesByCalculationNameByVariableNameArray",
      ) as Writable<ValuesByCalculationNameByVariableName[]>
      const waterfall = getContext("waterfall") as Writable<Waterfall>
    
      $: situationsToCompare = situationsToCompareIndex.map(
        (situationIndex) => $testCases[situationIndex],
      )
    
      function calculateTotal(
        evaluationByName: EvaluationByName,
        calculationName: CalculationName,
        rootDecompositionName: string,
        totalDecomposition: DecompositionReference[] | undefined,
      ): number {
        if (totalDecomposition === undefined) {
          return (
            evaluationByName[rootDecompositionName]?.calculationEvaluationByName[
              calculationName
            ]?.deltaAtVectorIndex ?? 0
          )
        }
        let total = 0