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

Fix ReadMore

parent f06cfb65
Branches
No related tags found
1 merge request!273Passage à Svelte 5
......@@ -49,7 +49,6 @@ export function requestAllBudgetCalculations(variableName: string): void {
export async function requestAllTestCasesCalculations(
requestedSituationIndex: number | null,
): Promise<void> {
$inspect("1")
if (
calculationNames.some((calculationName) => {
const situationIndex =
......@@ -59,7 +58,6 @@ export async function requestAllTestCasesCalculations(
)
})
) {
$inspect("2")
calculateTestCases(
Object.fromEntries(
calculationNames.map((calculationName) => {
......
<script lang="ts">
import { createBubbler } from "svelte/legacy"
const bubble = createBubbler()
interface Props {
// import { afterUpdate } from "svelte"
as: string
......@@ -17,6 +13,7 @@
as,
class: klass = "",
lines,
onclick,
text = "lire plus",
children,
...rest
......@@ -38,7 +35,7 @@
}
}
// afterUpdate(truncate)
$effect(truncate)
</script>
<svelte:window onresize={truncate} />
......@@ -51,10 +48,7 @@
>
{@render children?.()}
{#if truncated}
<button
class="absolute bottom-0 right-0 flex hover:underline"
onclick={bubble("click")}
>
<button class="absolute bottom-0 right-0 flex hover:underline" {onclick}>
<span class="block bg-gradient-to-r from-transparent to-white to-70% pl-8"
>...</span
>
......
......@@ -40,8 +40,6 @@
let yScaled = $derived($yScale(y))
let columnWidth = $derived(xScale.bandwidth())
$effect(() => $inspect("!", xScale.range(), xScale.bandwidth()))
</script>
{#if columnHeight > 0}
......
......@@ -157,7 +157,7 @@
as="span"
class="block overflow-hidden break-words font-serif text-sm leading-normal text-black"
lines={2}
on:click={() => ($variableModalOpen = true)}
onclick={() => ($variableModalOpen = true)}
>
{@html note}
</ReadMore>
......
......@@ -254,7 +254,6 @@ export async function calculateBudget(
export async function calculateTestCases(
situationIndexByCalculationName: RequestedSituationIndexByCalculationName,
) {
$inspect("3")
const aggregatedSituation: SituationWithAxes = {}
const axesData: { situationIndex: number; variables: string[] } =
shared.axes.reduce(
......@@ -279,7 +278,6 @@ export async function calculateTestCases(
(situationIndex) => situationIndex === null,
)
) {
$inspect("4")
let personIndex = -1
// Some of the calculations are requested to be done for every situations.
// Aggregate every situations into a single one without calculated variables.
......@@ -361,7 +359,6 @@ export async function calculateTestCases(
aggregatedSituation.axes = shared.axes
}
}
$inspect("5")
const message = {
period: year.toString(),
......@@ -370,7 +367,6 @@ export async function calculateTestCases(
const lawSituationIndex = situationIndexByCalculationName.law
if (lawSituationIndex !== undefined) {
$inspect("6")
const calculation: Calculation = (newCalculationByName.law = {
running: true,
})
......@@ -395,14 +391,12 @@ export async function calculateTestCases(
}
sendTestCasesSimulation("law", calculation.input) // Don't wait for result.
}
$inspect("7")
const revaluationSituationIndex = situationIndexByCalculationName.revaluation
if (
revaluationSituationIndex !== undefined &&
revaluationName !== undefined
) {
$inspect("8")
const calculation: Calculation = (newCalculationByName.revaluation = {
running: true,
})
......@@ -429,11 +423,9 @@ export async function calculateTestCases(
}
sendTestCasesSimulation("revaluation", calculation.input) // Don't wait for result.
}
$inspect("9")
const billSituationIndex = situationIndexByCalculationName.bill
if (billSituationIndex !== undefined && billActive) {
$inspect("10")
const calculation: Calculation = (newCalculationByName.bill = {
running: true,
})
......@@ -460,11 +452,9 @@ export async function calculateTestCases(
}
sendTestCasesSimulation("bill", calculation.input) // Don't wait for result.
}
$inspect("11")
const amendmentSituationIndex = situationIndexByCalculationName.amendment
if (amendmentSituationIndex !== undefined) {
$inspect("12")
if (Object.keys(shared.parametricReform).length === 0) {
// Remove amendment evaluations from decompositions.
shared.evaluationByNameArray = shared.evaluationByNameArray.map(
......@@ -539,10 +529,8 @@ export async function calculateTestCases(
sendTestCasesSimulation("amendment", calculation.input) // Don't wait for result.
}
}
$inspect("13")
shared.calculationByName = newCalculationByName
$inspect("14")
}
export function calculateTestCasesAdditionalVariables(
......
......@@ -138,14 +138,11 @@
Object.keys(requestedCalculations.situationIndexByCalculationName)
.length > 0
) {
$inspect("avant", requestedCalculations.situationIndexByCalculationName)
const situationIndexByCalculationName =
requestedCalculations.situationIndexByCalculationName
requestedCalculations.situationIndexByCalculationName = {}
$inspect("après", requestedCalculations.situationIndexByCalculationName)
calculateTestCases(situationIndexByCalculationName)
}
$inspect("fin")
})
$effect(() => {
if (shared.requestedVariablesNameToCalculate !== undefined) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment