From 044ae521d26eb0141464ee6795a92bbe218b681f Mon Sep 17 00:00:00 2001 From: Ava Shilling <165050625+avashilling@users.noreply.github.com> Date: Wed, 11 Feb 2026 15:06:11 -0500 Subject: [PATCH] chore: dont allow reclicking choices --- .../analytics_practice_page.dart | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/pangea/analytics_practice/analytics_practice_page.dart b/lib/pangea/analytics_practice/analytics_practice_page.dart index 42d3e452a..989c4c922 100644 --- a/lib/pangea/analytics_practice/analytics_practice_page.dart +++ b/lib/pangea/analytics_practice/analytics_practice_page.dart @@ -97,7 +97,7 @@ class AnalyticsPracticeState extends State final ValueNotifier hintPressedNotifier = ValueNotifier(false); - final Set _selectedCorrectAnswers = {}; + final Set _clickedChoices = {}; // Track if we're showing the completion message for audio activities final ValueNotifier showingAudioCompletion = ValueNotifier(false); @@ -347,7 +347,7 @@ class AnalyticsPracticeState extends State activityState.value = const AsyncState.loading(); selectedMorphChoice.value = null; hintPressedNotifier.value = false; - _selectedCorrectAnswers.clear(); + _clickedChoices.clear(); final nextActivityCompleter = _queue.removeFirst(); try { @@ -565,6 +565,14 @@ class AnalyticsPracticeState extends State if (_currentActivity == null) return; final activity = _currentActivity!; + // Mark this choice as clicked so it can't be clicked again + if (_clickedChoices.contains(choiceContent)) { + return; + } else { + setState(() { + _clickedChoices.add(choiceContent); + }); + } // Track the selection for display if (activity is MorphPracticeActivityModel) { selectedMorphChoice.value = SelectedMorphChoice( @@ -577,9 +585,6 @@ class AnalyticsPracticeState extends State final isAudioActivity = activity.activityType == ActivityTypeEnum.lemmaAudio; - if (isAudioActivity && isCorrect) { - _selectedCorrectAnswers.add(choiceContent); - } if (isCorrect && !isAudioActivity) { // Non-audio activities disable choices after first correct answer @@ -602,11 +607,11 @@ class AnalyticsPracticeState extends State if (!isCorrect) return; - // For audio activities, check if all answers have been selected + // For audio activities, check if all correct answers have been clicked if (isAudioActivity) { final allAnswers = activity.multipleChoiceContent.answers; final allSelected = allAnswers.every( - (answer) => _selectedCorrectAnswers.contains(answer), + (answer) => _clickedChoices.contains(answer), ); if (!allSelected) {