diff --git a/frontend/src/routes/form/[slug]/+page.svelte b/frontend/src/routes/form/[slug]/+page.svelte index 7b4fb1d..9dc3184 100644 --- a/frontend/src/routes/form/[slug]/+page.svelte +++ b/frontend/src/routes/form/[slug]/+page.svelte @@ -13,6 +13,8 @@ let questionAnswer2Text: string = "" let questionAnswer2ID: number = 0 let questionNumber: number = 0 + + let shouldSwitch = false; let question1Answered: boolean = false let question2Answered: boolean = false @@ -60,16 +62,24 @@ // On mount, call the update function onMount(() => { updateQuestionData(); + shouldSwitch = Math.random() >= 0.5; }); -
+
-
- {#key questionNumber} - question1Answered = e.detail} answerNum={1} answerText={questionAnswer1Text} answerID={questionAnswer1ID}/> - question2Answered = e.detail} answerNum={2} answerText={questionAnswer2Text} answerID={questionAnswer2ID}/> - {/key} +
+ {#if shouldSwitch} + {#key questionNumber} + question2Answered = e.detail} answerNum={2} answerText={questionAnswer2Text} answerID={questionAnswer2ID}/> + question1Answered = e.detail} answerNum={1} answerText={questionAnswer1Text} answerID={questionAnswer1ID}/> + {/key} + {:else} + {#key questionNumber} + question1Answered = e.detail} answerNum={1} answerText={questionAnswer1Text} answerID={questionAnswer1ID}/> + question2Answered = e.detail} answerNum={2} answerText={questionAnswer2Text} answerID={questionAnswer2ID}/> + {/key} + {/if}
{#key questionNumber}