fix: update activity session progress value on complete session, add cutoff times for recent practice uses to all target generators (#5889)
This commit is contained in:
parent
d5ae87abf7
commit
1f5908721b
4 changed files with 31 additions and 0 deletions
|
|
@ -239,6 +239,7 @@ class AnalyticsPracticeState extends State<AnalyticsPractice>
|
|||
|
||||
Future<void> _completeSession() async {
|
||||
_sessionController.completeSession();
|
||||
progress.value = _sessionController.progress;
|
||||
setState(() {});
|
||||
|
||||
final bonus = _sessionController.bonusUses;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class GrammarMatchTargetGenerator {
|
|||
final sortedConstructs = constructs.practiceSort(activityType);
|
||||
|
||||
final Set<String> seenForms = {};
|
||||
final cutoffTime = DateTime.now().subtract(const Duration(hours: 24));
|
||||
|
||||
final morphInfoResult = await MorphsRepo.get(
|
||||
MatrixState.pangeaController.userController.userL2,
|
||||
|
|
@ -52,6 +53,14 @@ class GrammarMatchTargetGenerator {
|
|||
continue;
|
||||
}
|
||||
|
||||
final lastPracticeUse = construct.lastUseByTypes(
|
||||
activityType.associatedUseTypes,
|
||||
);
|
||||
|
||||
if (lastPracticeUse != null && lastPracticeUse.isAfter(cutoffTime)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<InlineSpan>? exampleMessage;
|
||||
final constructForms = construct.cappedUses
|
||||
.where((u) => u.form != null)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ class VocabAudioTargetGenerator {
|
|||
|
||||
final Set<String> seenLemmas = {};
|
||||
final Set<String> seenEventIds = {};
|
||||
final cutoffTime = DateTime.now().subtract(const Duration(hours: 24));
|
||||
|
||||
final targets = <AnalyticsActivityTarget>[];
|
||||
|
||||
for (final construct in sortedConstructs) {
|
||||
|
|
@ -27,6 +29,14 @@ class VocabAudioTargetGenerator {
|
|||
|
||||
if (seenLemmas.contains(construct.lemma)) continue;
|
||||
|
||||
final lastPracticeUse = construct.lastUseByTypes(
|
||||
activityType.associatedUseTypes,
|
||||
);
|
||||
|
||||
if (lastPracticeUse != null && lastPracticeUse.isAfter(cutoffTime)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to get an audio example message with token data for this lemma
|
||||
final exampleMessage = await ExampleMessageUtil.getAudioExampleMessage(
|
||||
construct,
|
||||
|
|
|
|||
|
|
@ -16,9 +16,20 @@ class VocabMeaningTargetGenerator {
|
|||
final sortedConstructs = constructs.practiceSort(activityType);
|
||||
|
||||
final Set<String> seenLemmas = {};
|
||||
final cutoffTime = DateTime.now().subtract(const Duration(hours: 24));
|
||||
|
||||
final targets = <AnalyticsActivityTarget>[];
|
||||
for (final construct in sortedConstructs) {
|
||||
if (seenLemmas.contains(construct.lemma)) continue;
|
||||
|
||||
final lastPracticeUse = construct.lastUseByTypes(
|
||||
activityType.associatedUseTypes,
|
||||
);
|
||||
|
||||
if (lastPracticeUse != null && lastPracticeUse.isAfter(cutoffTime)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
seenLemmas.add(construct.lemma);
|
||||
|
||||
if (!construct.cappedUses.any(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue