feat(learn): pick up learning on Home, the studysets studied latest first, and Progress closer to Vaia's
Home gets a widget of its own, Pick up learning, below the goal: the studysets at the top of the library that were studied, the one rated last first, so one studied long ago sinks. Three show, the others behind Show more. Each shows its name, which opens it, how much is learnt, when it was last studied, and today's task (cards to review, new cards to learn), which starts studying it, outlined while reviews wait. The progress is the library's, worked out once for every screen; when each was last studied comes from the reviews Home reads anyway. With nothing studied it takes no room. A dashboard arranged before it gets the widget below the goal, wherever the goal is: a widget a layout misses now goes after the one before it in a new dashboard, no longer at the end. On a studyset's Progress, the tiles are filled without an outline, To review has a history icon (amber while cards are due), the learnt bar is thicker, and the exam follows the figures, as Vaia asks for its date there: an invitation to choose it, opening the study plan's sheet, or, once chosen, how ready the person is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
447e00c52a
commit
a0bb75f1ad
1 changed files with 976 additions and 40 deletions
|
|
@ -0,0 +1,71 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/home/model/pick_up.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/study/model/rating.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/study/model/review.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/studyset/model/studyset.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/studyset/model/studyset_content.dart';
|
||||
|
||||
void main() {
|
||||
Studyset studyset(String id, {String? parent, DateTime? archivedAt}) =>
|
||||
Studyset(
|
||||
id: id,
|
||||
content: StudysetContent.titled(id),
|
||||
parentId: parent,
|
||||
archivedAt: archivedAt,
|
||||
);
|
||||
|
||||
Review rated(String card, DateTime at, {StudyMode mode = StudyMode.review}) =>
|
||||
Review(
|
||||
id: '$card-$at',
|
||||
cardId: card,
|
||||
rating: Rating.good,
|
||||
reviewedAt: at,
|
||||
duration: Duration.zero,
|
||||
mode: mode,
|
||||
);
|
||||
|
||||
test('the studysets studied, the one studied last first, each counting '
|
||||
'what was studied in its topics; one never studied is left out', () {
|
||||
final studysets = [
|
||||
studyset('japanese'),
|
||||
studyset('kana', parent: 'japanese'),
|
||||
studyset('latin'),
|
||||
studyset('psychology'),
|
||||
];
|
||||
final picked = pickUpOf(
|
||||
studysets,
|
||||
{'neko': 'japanese', 'a': 'kana', 'amo': 'latin'},
|
||||
[
|
||||
rated('neko', DateTime.utc(2026)),
|
||||
rated('amo', DateTime.utc(2026, 10)),
|
||||
// Studied in a topic: the studyset counts as studied then.
|
||||
rated('a', DateTime.utc(2026, 11)),
|
||||
],
|
||||
);
|
||||
|
||||
expect(
|
||||
[for (final each in picked) each.studyset.id],
|
||||
[
|
||||
'japanese',
|
||||
'latin',
|
||||
],
|
||||
);
|
||||
expect(picked.first.lastStudied, DateTime.utc(2026, 11));
|
||||
});
|
||||
|
||||
test('a fresh start is no studying, and an archived studyset rests', () {
|
||||
final picked = pickUpOf(
|
||||
[
|
||||
studyset('japanese'),
|
||||
studyset('latin', archivedAt: DateTime.utc(2026, 5)),
|
||||
],
|
||||
{'neko': 'japanese', 'amo': 'latin'},
|
||||
[
|
||||
rated('neko', DateTime.utc(2026, 11), mode: StudyMode.reset),
|
||||
rated('amo', DateTime.utc(2026, 11)),
|
||||
],
|
||||
);
|
||||
|
||||
expect(picked, isEmpty);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue