Gemeinsame Dokumentation für mehrere Beteiligte eines Vorgangs
CI / build-and-test (push) Canceled after 0s

Ein Dokumentationseintrag kann jetzt weitere Schüler*innen betreffen
(Documentation.AdditionalStudentIds, StudentId bleibt Hauptperson). Der
Eintrag existiert nur einmal, erscheint aber im Dokumentations-Tab jeder
beteiligten Person. Der Dokumentations-Dialog bietet in beiden
Vorgänge-Tabs "Betrifft außerdem" mit den Beteiligten des Vorgangs an.
Klassenlehrer-Listen, WebUntis-Abgleich, Löschfristen und
Referenzzählung berücksichtigen die weiteren Beteiligten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-09-28 08:43:24 +02:00
1 parent e091b5c8de
commit 9a84bbaa38
23 files changed
+396 -49

No files matched your search

@@ -308,4 +308,89 @@ public sealed class DocumentationDialogViewModelTests
Assert.Null(storage.OpenRead(storageId));
}
// ── Weitere Beteiligte ("Betrifft außerdem") ─────────────────────────────
[Fact]
public void WeitereBeteiligte_NeuerEintrag_UebernimmtAuswahlOhneHauptperson()
{
var anna = new StudentOption(Guid.NewGuid(), "Anna Beispiel");
var ben = new StudentOption(Guid.NewGuid(), "Ben Muster");
var cem = new StudentOption(Guid.NewGuid(), "Cem Test");
var vm = new DocumentationDialogViewModel(anna.Id, null, new FakeAttachmentStorage(),
coStudentOptions: [anna, ben, cem])
{
Title = "Konflikt", TypeName = "Vorkommnis",
};
Assert.True(vm.HasCoStudents);
Assert.True(vm.CoStudents.Single(c => c.Id == anna.Id).IsPrimary);
foreach (var c in vm.CoStudents) c.IsSelected = true;
vm.SaveCommand.Execute(null);
Assert.Equal(anna.Id, vm.Result!.StudentId);
Assert.Equal([ben.Id, cem.Id], vm.Result.AdditionalStudentIds);
}
[Fact]
public void WeitereBeteiligte_NurHauptpersonAlsKandidat_BlendetAuswahlAus()
{
var anna = new StudentOption(Guid.NewGuid(), "Anna Beispiel");
var vm = new DocumentationDialogViewModel(anna.Id, null, new FakeAttachmentStorage(), coStudentOptions: [anna]);
Assert.False(vm.HasCoStudents);
}
[Fact]
public void WeitereBeteiligte_WechselDerHauptperson_VerschiebtAusblendung()
{
var anna = new StudentOption(Guid.NewGuid(), "Anna Beispiel");
var ben = new StudentOption(Guid.NewGuid(), "Ben Muster");
var vm = new DocumentationDialogViewModel(anna.Id, null, new FakeAttachmentStorage(), [anna, ben],
coStudentOptions: [anna, ben])
{
Title = "Konflikt", TypeName = "Vorkommnis",
};
vm.CoStudents.Single(c => c.Id == anna.Id).IsSelected = true;
vm.SelectedStudent = ben;
vm.SaveCommand.Execute(null);
Assert.True(vm.CoStudents.Single(c => c.Id == ben.Id).IsPrimary);
Assert.Equal(ben.Id, vm.Result!.StudentId);
Assert.Equal([anna.Id], vm.Result.AdditionalStudentIds);
}
[Fact]
public void WeitereBeteiligte_BearbeitenOhneKandidaten_BehaeltBestehendeBei()
{
Guid anna = Guid.NewGuid(), ben = Guid.NewGuid();
var existing = new Documentation { StudentId = anna, AdditionalStudentIds = [ben], Title = "Konflikt" };
var vm = new DocumentationDialogViewModel(ben, existing, new FakeAttachmentStorage());
vm.SaveCommand.Execute(null);
Assert.Equal(anna, vm.Result!.StudentId);
Assert.Equal([ben], vm.Result.AdditionalStudentIds);
}
[Fact]
public void WeitereBeteiligte_Bearbeiten_AbwahlEntferntNurAngeboteneKandidaten()
{
var anna = new StudentOption(Guid.NewGuid(), "Anna Beispiel");
var ben = new StudentOption(Guid.NewGuid(), "Ben Muster");
var outsider = Guid.NewGuid();
var existing = new Documentation
{
StudentId = anna.Id, AdditionalStudentIds = [ben.Id, outsider], Title = "Konflikt",
};
var vm = new DocumentationDialogViewModel(anna.Id, existing, new FakeAttachmentStorage(),
coStudentOptions: [anna, ben]);
Assert.True(vm.CoStudents.Single(c => c.Id == ben.Id).IsSelected);
vm.CoStudents.Single(c => c.Id == ben.Id).IsSelected = false;
vm.SaveCommand.Execute(null);
Assert.Equal([outsider], vm.Result!.AdditionalStudentIds);
}
}