diff --git a/kit/src/lib/Question.svelte b/kit/src/lib/Question.svelte index 96c0f94d0..c436d5fbe 100644 --- a/kit/src/lib/Question.svelte +++ b/kit/src/lib/Question.svelte @@ -51,6 +51,12 @@ // after the decimal. return `${prefix}${Math.random().toString(36).substr(2, 9)}`; } + + function isSingleOption() { + // return whether there's single answer to the question or not + return choices.filter(c => c.correct).length === 1; + } +
@@ -91,6 +97,8 @@ You didn't select all the correct answers, there's more! + {:else if isSingleOption()} + You got it right! {:else} You got all the answers! {/if}