feat: improve WebUntis sync and competency insights
CI / build-and-test (push) Canceled after 0s

This commit is contained in:
admin committed 2026-09-20 22:17:29 +02:00
1 parent cdb4637c65
commit f0c0479bcb
22 files changed
+1099 -76

No files matched your search

@@ -108,6 +108,50 @@ public sealed class CompetencyAnalysisServiceTests
Assert.Empty(item.StudentScores);
}
[Fact]
public void Analyze_MitarbeitMitAutomatischerSchaetzung_FuelltKompetenzprofil()
{
var studentId = Guid.NewGuid();
var session = new ParticipationSession { Competencies = [Ref(K1)] };
var entry = new ParticipationEntry
{
SessionId = session.Id,
StudentId = studentId,
Ratings =
[
new AspectRating { Key = "quality", Value = 1 },
new AspectRating { Key = "quantity", Value = 2 },
],
};
var item = Assert.Single(_service.Analyze(Catalog(), [], [], [], [session], [entry],
[.. DefaultParticipationAspects.All]));
Assert.Equal(1, item.ParticipationSessionCount);
Assert.Equal(100, item.GroupScore!.Percent, 6); // Mittel 1,5 wird wie in der UI auf +2 gerundet.
Assert.Equal(1, item.GroupScore.ParticipationEvidenceCount);
Assert.Equal(100, item.StudentScores[studentId].Percent, 6);
}
[Fact]
public void Analyze_ManuelleKompetenzbewertung_UeberschreibtAutomatischeSchaetzung()
{
var studentId = Guid.NewGuid();
var session = new ParticipationSession { Competencies = [Ref(K1)] };
var entry = new ParticipationEntry
{
SessionId = session.Id,
StudentId = studentId,
Ratings = [new AspectRating { Key = "quality", Value = 2 }],
CompetencyRatings = [new CompetencyRating { ItemId = K1.Id, Value = -1 }],
};
var item = Assert.Single(_service.Analyze(Catalog(), [], [], [], [session], [entry],
[.. DefaultParticipationAspects.All]));
Assert.Equal(25, item.StudentScores[studentId].Percent, 6);
}
[Fact]
public void Analyze_GeloeschteKompetenz_BleibtMitGespeicherterMomentaufnahmeSichtbar()
{
+24
View File
@@ -60,6 +60,18 @@ public sealed class UntisDiffServiceTests
Assert.Contains("Fach weicht ab", entry.Description);
}
[Fact]
public void Diff_AbweichenderDoppelblock_ErzeugtVertretungFuerBeideStunden()
{
var mapping = BuildMapping(Guid.NewGuid());
mapping.CoveredPeriods = [1, 2];
var result = new UntisDiffService().Diff([BuildEvent("block", summary: "NAT")], [], [mapping], Monday);
Assert.Equal([1, 2], result.SubstitutionsToSave.Select(entry => entry.PeriodNumber).ToArray());
Assert.Equal(2, result.SubstitutionsToSave.Select(entry => entry.ExternalId).Distinct().Count());
}
[Fact]
public void Diff_AbweichendeKlasse_ErzeugtVertretungsstunde()
{
@@ -202,6 +214,18 @@ public sealed class UntisDiffServiceTests
Assert.Equal(1, entry.PeriodNumber);
}
[Fact]
public void Diff_StatusCancelledBeiDoppelblock_ErzeugtAusfallFuerBeideStunden()
{
var mapping = BuildMapping(Guid.NewGuid());
mapping.CoveredPeriods = [1, 2];
var result = new UntisDiffService().Diff([BuildEvent("block", status: "CANCELLED")], [], [mapping], Monday);
Assert.Equal([1, 2], result.SubstitutionsToSave.Select(entry => entry.PeriodNumber).ToArray());
Assert.All(result.SubstitutionsToSave, entry => Assert.Equal(SubstitutionKind.Cancelled, entry.Kind));
}
[Fact]
public void Diff_VerschwundenerTerminInnerhalbLookahead_ErzeugtAusfall()
{