qa: Handle standalones exercices

This commit is contained in:
nemunaire 2024-09-18 11:33:45 +02:00
parent a630075116
commit c293b58a94
2 changed files with 5 additions and 2 deletions

View File

@ -44,6 +44,7 @@ export const exercicesByTheme = derived(
const exercices_idx = { }; const exercices_idx = { };
for (const e of $exercices) { for (const e of $exercices) {
if (!e.id_theme) e.id_theme = 0;
if (!exercices_idx[e.id_theme]) { if (!exercices_idx[e.id_theme]) {
exercices_idx[e.id_theme] = [] exercices_idx[e.id_theme] = []
} }

View File

@ -141,7 +141,7 @@
bind:value={newTodo} bind:value={newTodo}
> >
{#each Object.keys($exercicesByTheme) as thid} {#each Object.keys($exercicesByTheme) as thid}
<optgroup label={$themesIdx[thid].name}> <optgroup label={(thid != "0" ? $themesIdx[thid].name : "Exercices indépendants")}>
{#each $exercicesByTheme[thid] as exercice (exercice.id)} {#each $exercicesByTheme[thid] as exercice (exercice.id)}
<option value={exercice.id}>{exercice.title}</option> <option value={exercice.id}>{exercice.title}</option>
{/each} {/each}
@ -171,7 +171,9 @@
bind:value={newThemeTodo} bind:value={newThemeTodo}
> >
{#each Object.keys($exercicesByTheme) as thid} {#each Object.keys($exercicesByTheme) as thid}
{#if thid != "0"}
<option value={$themesIdx[thid].id}>{$themesIdx[thid].name}</option> <option value={$themesIdx[thid].id}>{$themesIdx[thid].name}</option>
{/if}
{/each} {/each}
</select> </select>
<Button <Button