Defuse handled dashboard warnings and add a snooze action
CI / build-and-test (push) Canceled after 0s

Cross-class warnings (attendance, homework backlog, lateness) stayed red
and at the top even after being acted on. A warning now turns gray and
sorts to the bottom of its group once a recently-updated open Vorgang
with a matching tag exists, or once explicitly snoozed for 1/2/4 weeks.
Both are time-limited: once the grace period lapses without the
underlying number actually improving, the warning goes active again on
the next dashboard load - no background job needed since it's just
recomputed on every RebuildAttention.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Sonnet 5 committed 2026-09-26 00:48:39 +02:00
1 parent 3270b48850
commit 54ad7f7419
15 files changed
+421 -18

No files matched your search

+3
View File
@@ -76,6 +76,7 @@ public class LiteDbContext : IDisposable
public ILiteCollection<UntisHubJobState> UntisHubJobStates => _db.GetCollection<UntisHubJobState>("untis_hub_job_states");
public ILiteCollection<UntisStudentRosterCacheEntry> UntisStudentRosterCache => _db.GetCollection<UntisStudentRosterCacheEntry>("untis_student_roster_cache");
public ILiteCollection<AnnualPlanEvent> AnnualPlanEvents => _db.GetCollection<AnnualPlanEvent>("annual_plan_events");
public ILiteCollection<DashboardWarningSnooze> DashboardWarningSnoozes => _db.GetCollection<DashboardWarningSnooze>("dashboard_warning_snoozes");
public ILiteCollection<TrashedItem> TrashedItems => _db.GetCollection<TrashedItem>("trash");
public void Checkpoint() => _db.Checkpoint();
@@ -694,6 +695,8 @@ public class LiteDbContext : IDisposable
UntisStudentRosterCache.EnsureIndex(x => x.ClassName);
UntisCacheFetchStates.EnsureIndex("ux_class_kind",
BsonExpression.Create("STRING($.ClassName) + ':' + STRING($.Kind)"), unique: true);
DashboardWarningSnoozes.EnsureIndex("ux_student_tag",
BsonExpression.Create("STRING($.StudentId) + ':' + STRING($.WarningTag)"), unique: true);
}
public void Dispose() => _db.Dispose();
@@ -901,6 +901,14 @@ public class UntisCacheFetchStateRepository(LiteDbContext db) : IUntisCacheFetch
public void Save(UntisCacheFetchState state) => db.UntisCacheFetchStates.Upsert(state);
}
public class DashboardWarningSnoozeRepository(LiteDbContext db) : IDashboardWarningSnoozeRepository
{
public DashboardWarningSnooze? Get(Guid studentId, string warningTag) =>
db.DashboardWarningSnoozes.FindOne(s => s.StudentId == studentId && s.WarningTag == warningTag);
public List<DashboardWarningSnooze> GetAll() => db.DashboardWarningSnoozes.FindAll().ToList();
public void Save(DashboardWarningSnooze snooze) => db.DashboardWarningSnoozes.Upsert(snooze);
}
public class UntisHubJobStateRepository(LiteDbContext db) : IUntisHubJobStateRepository
{
public UntisHubJobState? Get(UntisHubJobKind kind, Guid? groupId) =>