diff --git a/src/lib/components/test_cases/TestCaseEdit.svelte b/src/lib/components/test_cases/TestCaseEdit.svelte index 164b5965dfb2fa542a40d2f3d67d9551ff35f3a5..e5f381358471271dea5ce230478033cbb3837b80 100644 --- a/src/lib/components/test_cases/TestCaseEdit.svelte +++ b/src/lib/components/test_cases/TestCaseEdit.svelte @@ -122,16 +122,13 @@ async function addPerson(id: string, isChild: boolean): Promise<void> { const entity = entityByKey[personEntityKey] - const personById = { - ...situation[entity.key_plural], - } + const personById = situation[entity.key_plural] const person = (personById[id] = {} as PopulationWithoutId) if (isChild) { person.date_naissance = { [year]: new Date(year - 10, 6, 2).toISOString().split("T")[0], } } - situation = { ...situation, [entity.key_plural]: personById } for (const groupEntity of Object.values(entityByKey) as GroupEntity[]) { if (groupEntity.is_person) { @@ -472,18 +469,12 @@ let personById = $derived( Object.fromEntries(persons.map((person) => [person.id, person])), ) - let adultsId - run(() => { - adultsId = [ - ...Object.keys(personById).filter((id) => id.startsWith("Adulte ")), - ] - }) - let childrenId - run(() => { - childrenId = [ - ...Object.keys(personById).filter((id) => id.startsWith("Enfant ")), - ] - }) + let adultsId = $state([ + ...Object.keys(personById).filter((id) => id.startsWith("Adulte ")), + ]) + let childrenId = $state([ + ...Object.keys(personById).filter((id) => id.startsWith("Enfant ")), + ]) let adultSituations = $derived( Object.entries(situation[personEntity.key_plural] ?? {}) .filter(([id]) => id.startsWith("Adulte "))