feat(learn): a studyset's subject, picked from a fixed list (ADR 0041)

A top studyset is filed under one of 44 subjects in six groups (the
developer's decisions of 9 and 10 Nov 2026): languages as one, computing
in five, Other / not sure last. Each has a Lucide icon and a default
colour, which picking it gives the studyset, its own to change from then
on. The studyset's sheet picks it (pickSubject); a sub-studyset shows its
top studyset's (subjectOf) and offers none. The payload keeps it as
`subject` (schema 8), so archives and published studysets carry it; an
ID this version doesn't know is kept and reads as none.

Whats-New: A studyset can now be filed under a subject, which gives it that subject's colour.
Whats-New-De: Ein Lernset lässt sich jetzt einem Fach zuordnen, das ihm dessen Farbe gibt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-10 18:37:17 +01:00
commit 9868dc27c6
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -46,11 +46,27 @@ void main() {
licenseYear: 2006,
frontLanguage: 'ja',
backLanguage: 'en',
subject: 'languages',
);
expect(decodeStudysetPayload(encodeStudysetPayload(content)), content);
});
test('keeps a subject this app version does not know, as a newer one '
'may add subjects', () {
final content = StudysetContent(
title: 'Origami',
description: RichContent.empty(),
subject: 'paper-folding',
);
expect(json(encodeStudysetPayload(content))['subject'], 'paper-folding');
expect(
decodeStudysetPayload(encodeStudysetPayload(content)).subject,
'paper-folding',
);
});
test('leaves out what is not given', () {
final payload = encodeStudysetPayload(
StudysetContent(title: 'Japanese', description: RichContent.empty()),
@ -59,7 +75,7 @@ void main() {
expect(json(payload).keys, {'schemaVersion', 'title', 'description'});
});
test('names its schema version: the seventh, which exam plans need', () {
test('names its schema version: the eighth, which subjects need', () {
final payload = encodeStudysetPayload(
StudysetContent(
title: 'Japanese',
@ -68,17 +84,17 @@ void main() {
),
);
expect(studysetSchemaVersion, 7);
expect(studysetSchemaVersion, 8);
expect(json(payload)['schemaVersion'], studysetSchemaVersion);
});
test('without study options, a bibliography or exam plans writes the '
'seventh schema all the same', () {
test('without study options, a bibliography, exam plans or a subject '
'writes the eighth schema all the same', () {
final payload = encodeStudysetPayload(
StudysetContent(title: 'Japanese', description: RichContent.empty()),
);
expect(json(payload)['schemaVersion'], 7);
expect(json(payload)['schemaVersion'], 8);
expect(json(payload).keys, isNot(contains('study')));
expect(json(payload).keys, isNot(contains('bibliography')));
expect(json(payload).keys, isNot(contains('examPlans')));