1123 multiple options are highlighted and cant move to the next item (#1124)
* once user has selected correct choice, disable further interaction * if not include tts on click, don't play tts on correct choice selected * fix range error when logging warning about having multiple 'other' categories
This commit is contained in:
parent
ceea63b3a2
commit
2397c8f78d
3 changed files with 45 additions and 34 deletions
|
|
@ -60,11 +60,16 @@ class ChoicesArrayState extends State<ChoicesArray> {
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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<OneConstructUse> 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<String> useKeys =
|
||||
entry.value.map((uses) => uses.id.string).toList();
|
||||
if (useKeys.length > 10) {
|
||||
useKeys = useKeys.sublist(0, 10);
|
||||
}
|
||||
("${entry.key}: $useKeys");
|
||||
}).toList(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,30 +81,30 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue