🐛 Fixed crash if switched from Range to Multiple-Choice

This commit is contained in:
Mawoka
2022-08-17 20:57:55 +02:00
parent 1e319c6346
commit b0f1bb0b50
2 changed files with 5 additions and 2 deletions
@@ -19,6 +19,9 @@
export let selected_question: number;
export let data: EditorData;
if (!Array.isArray(data.questions[selected_question].answers)) {
data.questions[selected_question].answers = [];
}
</script>
<div class="grid grid-cols-2 gap-4 w-full px-10">
+2 -2
View File
@@ -181,7 +181,7 @@
<div class="grid grid-cols-2 gap-2">
{#each question.answers as answer}
<span
class="whitespace-nowrap truncate rounded-lg p-0.5 text-sm text-center"
class="whitespace-nowrap truncate rounded-lg p-0.5 text-sm text-center border border-gray-700"
class:bg-green-500={answer.right}
class:bg-red-500={!answer.right}
class:bg-yellow-500={!reach(ABCDQuestionSchema, 'answer').isValidSync(
@@ -210,7 +210,7 @@
</div>
{/each}
<div
class="bg-white shadow rounded-lg h-40 p-2 mb-6 hover:cursor-pointer drop-shadow-2xl border border-gray-500"
class="bg-white shadow rounded-lg h-40 p-2 mb-6 hover:cursor-pointer drop-shadow-2xl border border-gray-500 dark:bg-gray-600"
>
<button
type="button"