If there is no themes, display all exercices
Some checks are pending
continuous-integration/drone/push Build is running

This commit is contained in:
nemunaire 2024-09-13 12:05:30 +02:00
parent caae846bc7
commit 8bb8cb18e3

View File

@ -35,33 +35,39 @@
} }
if ($themesStore["0"] && !$themesStore["0"].locked && $themesStore["0"].exercices) { if ($themesStore["0"] && !$themesStore["0"].locked && $themesStore["0"].exercices) {
let nb_ex_max = tmpitems.length; if (tmpitems.length) {
let i = 1; let nb_ex_max = tmpitems.length;
let j = 0; let i = 1;
for (j = $themesStore["0"].exercices.length - 1; j >= 0 && i < tmpitems.length; j--) { let j = 0;
if ($my && $my.team_id && !$my.exercices[$themesStore["0"].exercices[j].id]) { for (j = $themesStore["0"].exercices.length - 1; j >= 0 && i < tmpitems.length; j--) {
// Only apply after start if ($my && $my.team_id && !$my.exercices[$themesStore["0"].exercices[j].id]) {
if (!($time.startIn && j < nb_ex_max && j < $settings.unlockedStandaloneExercices)) // Only apply after start
if (!($time.startIn && j < nb_ex_max && j < $settings.unlockedStandaloneExercices))
continue;
} else if ($my && !$my.team_id && j >= nb_ex_max) {
continue; continue;
} else if ($my && !$my.team_id && j >= nb_ex_max) { }
continue;
tmpitems.splice(i, 0, {id: tmpitems.length, theme: $themesStore["0"], exercice: $themesStore["0"].exercices[j]});
i += 2;
} }
tmpitems.splice(i, 0, {id: tmpitems.length, theme: $themesStore["0"], exercice: $themesStore["0"].exercices[j]}); if (j >= 0 || i == 1) {
i += 2; tmpitems.push({
} id: tmpitems.length,
theme: {
if (j >= 0 || i == 1) { ...$themesStore["0"],
tmpitems.push({ name: "Voir les autres défis",
id: tmpitems.length, headline: "Il y a " + ($themesStore["0"].exercices.length) + " défis à découvrir&nbsp;! Cliquez ici pour les afficher.",
theme: { locked: $themesStore["0"].locked || i == 1,
...$themesStore["0"], },
name: "Voir les autres défis", color: "light",
headline: "Il y a " + ($themesStore["0"].exercices.length) + " défis à découvrir&nbsp;! Cliquez ici pour les afficher.", });
locked: $themesStore["0"].locked || i == 1, }
}, } else {
color: "light", for (const j in $themesStore["0"].exercices) {
}); tmpitems.push({id: tmpitems.length, theme: $themesStore["0"], exercice: $themesStore["0"].exercices[j]});
}
} }
} }