From e194bec5e24348f90a00eece1883cb312acc8c51 Mon Sep 17 00:00:00 2001 From: Drikus Roor Date: Mon, 9 Sep 2024 15:40:11 +0200 Subject: [PATCH] refactor: Simplify break round condition in Trial component --- frontend/src/components/Trial/Trial.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Trial/Trial.tsx b/frontend/src/components/Trial/Trial.tsx index 358fc7d85..55cbc7d53 100644 --- a/frontend/src/components/Trial/Trial.tsx +++ b/frontend/src/components/Trial/Trial.tsx @@ -95,9 +95,8 @@ const Trial = (props: TrialProps) => { form.map((formElement => (formElement.value = formElement.value || ''))) } - const breakRoundOn = config.break_round_on; - const shouldBreakRound = breakRoundOn && checkBreakRound(form.map((formElement) => formElement.value), breakRoundOn); - const shouldCallOnNextInOnResult = !shouldBreakRound + const breakRoundConditions = config.break_round_on; + const shouldBreakRound = breakRoundConditions && checkBreakRound(form.map((formElement) => formElement.value), breakRoundConditions); await onResult( { @@ -106,8 +105,9 @@ const Trial = (props: TrialProps) => { config }, false, - // if we break the round, we don't want to call onNext in onResult - shouldCallOnNextInOnResult + // if we break the round, we don't want to call `onNext` in `onResult` + // as it does not allow us to pass a `breakRound` flag + !shouldBreakRound ); if (shouldBreakRound) {