CI / build-and-test (push) Canceled after 0s
Manuelle Einzelerfassung je Kompetenz war im Alltag zu aufwendig (Nutzer-Feedback). Neue ParticipationCompetencyEstimate mittelt die bereits erfassten Aspekt-Bewertungen der Sitzung (normiert auf dieselbe -2..+2-Achse) und rundet auf den nächsten Schritt; die Tagesflagge wirkt symmetrisch (Spitzentag hebt, Schlaftag/Schlechter Tag senken gleichermaßen). Die Schätzung wird nie automatisch gespeichert - sie erscheint nur als abgeschwächt dargestellter Zellenwert (RatingCell.IsEstimated), solange keine explizite Bewertung existiert. Ein Klick setzt den Wert bewusst und persistiert ihn wie bisher. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
99 lines
3.5 KiB
C#
99 lines
3.5 KiB
C#
using LehrerApp.Core.Models;
|
|
using LehrerApp.Desktop.ViewModels.Groups;
|
|
using Xunit;
|
|
|
|
namespace LehrerApp.Desktop.Tests;
|
|
|
|
/// Nutzer-Feedback: Kompetenzen je Sitzung von Hand zu bewerten ist zu aufwendig - eine Schätzung
|
|
/// aus dem allgemeinen Mitarbeit-Durchschnitt ersetzt die manuelle Erfassung im Regelfall.
|
|
public sealed class ParticipationCompetencyEstimateTests
|
|
{
|
|
private static readonly AspectColumnDef Quality = new(new ParticipationAspect { Key = "quality", ValueType = AspectValueType.Scale5 });
|
|
private static readonly AspectColumnDef Quantity = new(new ParticipationAspect { Key = "quantity", ValueType = AspectValueType.Scale5 });
|
|
private static readonly AspectColumnDef Points = new(new ParticipationAspect { Key = "points", ValueType = AspectValueType.Points, MaxPoints = 4 });
|
|
|
|
[Fact]
|
|
public void Estimate_OhneBewertungen_LiefertNull()
|
|
{
|
|
var estimate = ParticipationCompetencyEstimate.Estimate([], [Quality], null);
|
|
|
|
Assert.Null(estimate);
|
|
}
|
|
|
|
[Fact]
|
|
public void Estimate_MittelwertMehrererAspekte_RundetAufNaechstenSchritt()
|
|
{
|
|
var ratings = new List<AspectRating>
|
|
{
|
|
new() { Key = "quality", Value = 1 },
|
|
new() { Key = "quantity", Value = 2 },
|
|
};
|
|
|
|
var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality, Quantity], null);
|
|
|
|
Assert.Equal(2, estimate); // Mittelwert 1.5 -> AwayFromZero gerundet auf 2
|
|
}
|
|
|
|
[Fact]
|
|
public void Estimate_Spitzentag_HebtDieSchaetzungAn()
|
|
{
|
|
var ratings = new List<AspectRating> { new() { Key = "quality", Value = 0 } };
|
|
|
|
var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality], DayHighlightKind.Standout);
|
|
|
|
Assert.Equal(1, estimate);
|
|
}
|
|
|
|
[Fact]
|
|
public void Estimate_Schlaftag_SenktDieSchaetzung()
|
|
{
|
|
var ratings = new List<AspectRating> { new() { Key = "quality", Value = 0 } };
|
|
|
|
var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality], DayHighlightKind.Sleepy);
|
|
|
|
Assert.Equal(-1, estimate);
|
|
}
|
|
|
|
[Fact]
|
|
public void Estimate_SchlechterTag_SenktDieSchaetzungGleichWieSchlaftag()
|
|
{
|
|
var ratings = new List<AspectRating> { new() { Key = "quality", Value = 0 } };
|
|
|
|
var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality], DayHighlightKind.Rough);
|
|
|
|
Assert.Equal(-1, estimate);
|
|
}
|
|
|
|
[Fact]
|
|
public void Estimate_KapptAufDenGueltigenBereich()
|
|
{
|
|
var ratings = new List<AspectRating> { new() { Key = "quality", Value = 2 } };
|
|
|
|
var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality], DayHighlightKind.Standout);
|
|
|
|
Assert.Equal(2, estimate); // 2 + 1 würde 3 ergeben, wird auf 2 gekappt
|
|
}
|
|
|
|
[Fact]
|
|
public void Estimate_BeruecksichtigtNurBewerteteAspekte()
|
|
{
|
|
// "quantity" wurde nie bewertet - fließt nicht als 0 in den Mittelwert ein.
|
|
var ratings = new List<AspectRating> { new() { Key = "quality", Value = 2 } };
|
|
|
|
var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality, Quantity], null);
|
|
|
|
Assert.Equal(2, estimate);
|
|
}
|
|
|
|
[Fact]
|
|
public void Estimate_PunkteAspekt_WirdAufDieMinus2Bis2AchseNormiert()
|
|
{
|
|
// 4 von 4 Punkten -> oberes Ende der Achse (+2).
|
|
var ratings = new List<AspectRating> { new() { Key = "points", Value = 4 } };
|
|
|
|
var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Points], null);
|
|
|
|
Assert.Equal(2, estimate);
|
|
}
|
|
}
|