chore: shuffle practice tokens before selecting the ones to include (#4097)
This commit is contained in:
parent
2ca92dea87
commit
c8e67a5c89
2 changed files with 16 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ class PracticeMatchActivity {
|
|||
final String choiceContent = matchEntry.value.firstWhere(
|
||||
(element) => !usedForms.contains(element),
|
||||
orElse: () => throw Exception(
|
||||
"No unique form available for construct ${matchEntry.key}",
|
||||
"No unique form available for construct ${matchEntry.key.form}",
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -160,10 +160,24 @@ class PracticeSelection {
|
|||
return [];
|
||||
}
|
||||
|
||||
final List<PangeaToken> activityTokens = [];
|
||||
tokens.shuffle();
|
||||
for (final t in tokens) {
|
||||
if (activityTokens.length >= _maxQueueLength) {
|
||||
break;
|
||||
}
|
||||
if (!activityTokens.any(
|
||||
(token) =>
|
||||
token.text.content.toLowerCase() == t.text.content.toLowerCase(),
|
||||
)) {
|
||||
activityTokens.add(t);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
PracticeTarget(
|
||||
activityType: activityType,
|
||||
tokens: tokens.take(_maxQueueLength).shuffled().toList(),
|
||||
tokens: activityTokens,
|
||||
userL2: _userL2,
|
||||
),
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue