diff --git a/lib/pangea/choreographer/widgets/choice_array.dart b/lib/pangea/choreographer/widgets/choice_array.dart index ffae01e85..b175a6430 100644 --- a/lib/pangea/choreographer/widgets/choice_array.dart +++ b/lib/pangea/choreographer/widgets/choice_array.dart @@ -60,11 +60,16 @@ class ChoicesArrayState extends State { } void enableInteractions() { + if (_hasSelectedCorrectChoice) return; WidgetsBinding.instance.addPostFrameCallback((_) { if (mounted) setState(() => interactionDisabled = false); }); } + bool get _hasSelectedCorrectChoice => + widget.choices?.any((choice) => choice.isGold && choice.color != null) ?? + false; + @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); diff --git a/lib/pangea/models/analytics/construct_list_model.dart b/lib/pangea/models/analytics/construct_list_model.dart index 255eae4b4..eff981346 100644 --- a/lib/pangea/models/analytics/construct_list_model.dart +++ b/lib/pangea/models/analytics/construct_list_model.dart @@ -48,10 +48,14 @@ class ConstructListModel { /// Given a list of new construct uses, update the map of construct /// IDs to ConstructUses and re-sort the list of ConstructUses void updateConstructs(List newUses) { - _updateConstructMap(newUses); - _updateConstructList(); - _updateCategoriesToUses(); - _updateMetrics(); + try { + _updateConstructMap(newUses); + _updateConstructList(); + _updateCategoriesToUses(); + _updateMetrics(); + } catch (err, s) { + ErrorHandler.logError(e: "Failed to update analytics: $err", s: s); + } } int _sortConstructs(ConstructUses a, ConstructUses b) { @@ -126,12 +130,14 @@ class ConstructListModel { ErrorHandler.logError( e: "More than one 'other' category in groupedByCategory", data: { - "others": others - .map( - (entry) => - ("${entry.key}: ${entry.value.map((uses) => uses.id.string).toList().sublist(0, 10)}"), - ) - .toList(), + "others": others.map((entry) { + List useKeys = + entry.value.map((uses) => uses.id.string).toList(); + if (useKeys.length > 10) { + useKeys = useKeys.sublist(0, 10); + } + ("${entry.key}: $useKeys"); + }).toList(), }, ); } diff --git a/lib/pangea/widgets/practice_activity/multiple_choice_activity.dart b/lib/pangea/widgets/practice_activity/multiple_choice_activity.dart index 40d9a0046..ee741dda7 100644 --- a/lib/pangea/widgets/practice_activity/multiple_choice_activity.dart +++ b/lib/pangea/widgets/practice_activity/multiple_choice_activity.dart @@ -81,30 +81,30 @@ class MultipleChoiceActivityState extends State { final bool isCorrect = widget.currentActivity.content.isCorrect(value, index); - // If the activity is not set to include TTS on click, and the choice is correct, speak the target tokens - // We have to check if tokens - if (!widget.currentActivity.activityType.includeTTSOnClick && - isCorrect && - mounted) { - // should be set by now but just in case we make a mistake - if (widget.practiceCardController.currentActivity?.targetTokens == null) { - debugger(when: kDebugMode); - ErrorHandler.logError( - e: "Missing target tokens in multiple choice activity", - data: { - "currentActivity": widget.practiceCardController.currentActivity, - }, - ); - } else { - tts.tryToSpeak( - PangeaToken.reconstructText( - widget.practiceCardController.currentActivity!.targetTokens!, - ), - context, - null, - ); - } - } + // // If the activity is not set to include TTS on click, and the choice is correct, speak the target tokens + // // We have to check if tokens + // if (!widget.currentActivity.activityType.includeTTSOnClick && + // isCorrect && + // mounted) { + // // should be set by now but just in case we make a mistake + // if (widget.practiceCardController.currentActivity?.targetTokens == null) { + // debugger(when: kDebugMode); + // ErrorHandler.logError( + // e: "Missing target tokens in multiple choice activity", + // data: { + // "currentActivity": widget.practiceCardController.currentActivity, + // }, + // ); + // } else { + // tts.tryToSpeak( + // PangeaToken.reconstructText( + // widget.practiceCardController.currentActivity!.targetTokens!, + // ), + // context, + // null, + // ); + // } + // } if (currentRecordModel?.hasTextResponse(value) ?? false) { return;