feat: Kompetenz-Bewertung je Schüler/Sitzung aus Mitarbeit-Durchschnitt schätzen
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>
This commit is contained in:
adminandClaude Sonnet 5 committed 2026-09-19 01:57:45 +02:00
1 parent 51e55e1464
commit 455f7765e4
6 files changed
+234 -5

No files matched your search

@@ -443,10 +443,16 @@ public partial class ParticipationStudentRow : ObservableObject
// AspectKey trägt hier den Kompetenz-ItemId als String - reiner In-Memory-Transport
// zwischen Zelle und Save-Callback (siehe SaveCompetencyRating), nie persistiert.
// Ohne eigene Bewertung wird aus dem Mitarbeit-Durchschnitt der Sitzung geschätzt
// (Nutzer-Feedback: manuelle Einzelerfassung je Kompetenz ist im Alltag zu aufwendig) -
// die Schätzung wird NIE automatisch gespeichert, nur angezeigt (siehe RatingCell.IsEstimated);
// ein Klick auf die Zelle setzt den Wert bewusst und persistiert ihn wie gehabt.
var estimate = ParticipationCompetencyEstimate.Estimate(entry.Ratings, aspects, entry.DayHighlight);
foreach (var competency in competencies)
{
var existing = entry.CompetencyRatings.FirstOrDefault(r => r.ItemId == competency.ItemId);
var cell = new RatingCell(id, competency.ItemId.ToString("D"), existing?.Value);
var cell = new RatingCell(id, competency.ItemId.ToString("D"), existing?.Value ?? estimate,
isEstimated: existing is null && estimate is not null);
cell.OnChanged = (sid, key, val) => OnCompetencyRatingChanged?.Invoke(sid, key, val);
CompetencyCells.Add(cell);
}
@@ -672,22 +678,33 @@ public partial class RatingCell : ObservableObject
[ObservableProperty] private int? _value;
[ObservableProperty] private string _displayLabel = "";
/// <summary>true, solange Value aus ParticipationCompetencyEstimate geschätzt und noch nie
/// explizit vom Nutzer gesetzt wurde (siehe ParticipationStudentRow) - steuert nur die Anzeige
/// (reduzierte Deckkraft), nichts davon ist in ParticipationEntry.CompetencyRatings persistiert.
/// Wird bei jedem SetValue-Aufruf unwiderruflich auf false gesetzt, auch wenn der Nutzer
/// zufällig genau den geschätzten Wert bestätigt - ab dann zählt es als bewusste Entscheidung.</summary>
[ObservableProperty] private bool _isEstimated;
public Action<Guid, string, int?>? OnChanged { get; set; }
public RatingCell(Guid studentId, string key, int? value,
AspectValueType type = AspectValueType.Scale5, int maxPoints = 5)
AspectValueType type = AspectValueType.Scale5, int maxPoints = 5, bool isEstimated = false)
{
StudentId = studentId;
AspectKey = key;
Type = type;
MaxPoints = maxPoints;
_value = type == AspectValueType.Points && value is { } v ? Math.Clamp(v, 0, maxPoints) : value;
_isEstimated = isEstimated;
UpdateLabel();
}
public void SetValue(int? value)
{
// Reihenfolge wichtig: IsEstimated zuerst, damit ein auf Value lauschender Zellen-Renderer
// (siehe ParticipationTabView.axaml.cs) beim Auswerten von Value bereits den korrekten
// "bestätigt statt geschätzt"-Zustand sieht.
IsEstimated = false;
Value = Type == AspectValueType.Points && value is { } v ? Math.Clamp(v, 0, MaxPoints) : value;
UpdateLabel();
OnChanged?.Invoke(StudentId, AspectKey, Value);
@@ -741,6 +758,37 @@ public class AspectColumnDef
}
}
/// <summary>Nutzer-Feedback: Kompetenzen je Sitzung einzeln von Hand zu bewerten ist im Alltag zu
/// aufwendig - eine Schätzung aus dem allgemeinen Mitarbeit-Durchschnitt der Sitzung (auf derselben
/// -2..+2-Achse wie die Kompetenz-Bewertung selbst, siehe ParticipationRatingScale.Normalize) ersetzt
/// die manuelle Erfassung im Regelfall; die Lehrkraft korrigiert nur noch die Ausnahmen von Hand.
/// Die Tagesflagge wirkt bewusst symmetrisch (Nutzer-Entscheidung): Spitzentag hebt, Schlaftag und
/// Schlechter Tag senken die Schätzung gleichermaßen, obwohl "Schlaftag" strenggenommen eher die
/// Tagesform als die fachliche Kompetenz beschreibt.</summary>
public static class ParticipationCompetencyEstimate
{
private const double DayHighlightAdjustment = 1.0;
public static int? Estimate(List<AspectRating> ratings, IReadOnlyList<AspectColumnDef> aspects, DayHighlightKind? dayHighlight)
{
var normalized = ratings
.Select(r => (Rating: r, Def: aspects.FirstOrDefault(a => a.Key == r.Key)))
.Where(x => x.Def is not null)
.Select(x => ParticipationRatingScale.Normalize(x.Def!.ValueType, x.Rating.Value, x.Def.MaxPoints))
.ToList();
if (normalized.Count == 0) return null;
var adjustment = dayHighlight switch
{
DayHighlightKind.Standout => DayHighlightAdjustment,
DayHighlightKind.Sleepy or DayHighlightKind.Rough => -DayHighlightAdjustment,
_ => 0,
};
var estimate = (int)Math.Round(normalized.Average() + adjustment, MidpointRounding.AwayFromZero);
return Math.Clamp(estimate, -2, 2);
}
}
public class ParticipationSessionItem
{
public Guid Id { get; }
@@ -133,15 +133,22 @@ public partial class ParticipationTabView : UserControl
Content = label,
Padding = new Avalonia.Thickness(5, 1),
FontSize = 11,
Opacity = cell.Value == val ? 1.0 : 0.3,
Opacity = StepOpacity(cell, val),
IsEnabled = !isReadOnly,
};
var capturedVal = val;
void UpdateTip() => ToolTip.SetTip(btn, cell.IsEstimated && cell.Value == capturedVal
? "Geschätzt aus dem Mitarbeit-Durchschnitt der Sitzung - anklicken, um zu bestätigen/ändern."
: null);
UpdateTip();
btn.Click += (_, _) => cell.SetValue(capturedVal);
cell.PropertyChanged += (_, pe) =>
{
if (pe.PropertyName == nameof(RatingCell.Value))
btn.Opacity = cell.Value == capturedVal ? 1.0 : 0.3;
if (pe.PropertyName is nameof(RatingCell.Value) or nameof(RatingCell.IsEstimated))
{
btn.Opacity = StepOpacity(cell, capturedVal);
UpdateTip();
}
};
panel.Children.Add(btn);
}
@@ -149,6 +156,12 @@ public partial class ParticipationTabView : UserControl
return panel;
}
// Geschätzte (noch nicht bestätigte) Werte werden abgeschwächt dargestellt (siehe
// ParticipationCompetencyEstimate) - deutlich sichtbar genug, um nicht wie eine bewusste
// Bewertung zu wirken, aber klar erkennbar heller als "nicht ausgewählt".
private static double StepOpacity(RatingCell cell, int val) =>
cell.Value != val ? 0.3 : cell.IsEstimated ? 0.6 : 1.0;
private static Control BuildPointsCell(RatingCell cell, bool isReadOnly)
{
var updown = new NumericUpDown