🐛 Fixed crash where switched from Range to Multiple Choice

This commit is contained in:
Mawoka
2022-08-17 21:30:53 +02:00
parent 81eb4f01c4
commit 12ec2ebf94
2 changed files with 87 additions and 76 deletions
+21 -18
View File
@@ -179,24 +179,27 @@
{/if}
{#if question.type === QuizQuestionType.ABCD}
<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 border border-gray-700"
class:bg-green-500={answer.right}
class:bg-red-500={!answer.right}
class:bg-yellow-500={!reach(ABCDQuestionSchema, 'answer').isValidSync(
answer.answer
)}
use:tippy={{
content: answer.answer === '' ? 'Empty...' : answer.answer
}}
>{#if answer.answer === ''}
<i>Empty...</i>
{:else}
{answer.answer}
{/if}</span
>
{/each}
{#if Array.isArray(question.answers)}
{#each question.answers as answer}
<span
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(answer.answer)}
use:tippy={{
content: answer.answer === '' ? 'Empty...' : answer.answer
}}
>{#if answer.answer === ''}
<i>Empty...</i>
{:else}
{answer.answer}
{/if}</span
>
{/each}
{/if}
</div>
{:else if question.type === QuizQuestionType.RANGE}
<p class="text-center text-sm p-0.5">