Kapitel 3.1: Mitarbeit-Aspekte pro Gruppe verwalten (3.1.1/3.1.2/3.1.4)
Neuer Button "Aspekte verwalten" im Mitarbeit-Tab öffnet ParticipationAspectsDialog: Anlegen, Bezeichnung/Typ/Gewichtung/Aktiv-Status bearbeiten (speichert sofort, gleiches Muster wie die bestehende Gewichtungs-Bearbeitung in 3.2.1), Hoch/Runter-Reihenfolge, Löschen mit Rückfrage. Verwaltet bewusst nur die gruppenspezifischen Aspekte, nicht den bislang nirgends befüllten globalen Standardkatalog. Schlüssel ist nur beim Neuanlegen editierbar - er verknüpft AspectRating mit dem Aspekt per Key, ein nachträgliches Umbenennen würde historische Bewertungen unauffindbar machen. IParticipationAspectRepository.Save validiert jetzt Pflichtfelder und Schlüssel-Eindeutigkeit gegen globale Standards UND eigene Gruppen-Aspekte zusammen, da beide im Bewertungsraster kombiniert verwendet werden. Neue GetAllByGroup-Methode (inkl. inaktiver) für die Verwaltungsansicht. 3.1.3 (Scale3/Binary/Points im Bewertungsraster selbst) bewusst nicht angefasst - eigener, größerer Eingriff in die Bewertungs-UI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -439,9 +439,24 @@ public class ParticipationAspectRepository(LiteDbContext db) : IParticipationAsp
|
||||
db.ParticipationAspects.Find(a => a.GroupId == null && a.IsActive).OrderBy(a => a.SortOrder).ToList();
|
||||
public List<ParticipationAspect> GetByGroup(Guid groupId) =>
|
||||
db.ParticipationAspects.Find(a => a.GroupId == groupId && a.IsActive).OrderBy(a => a.SortOrder).ToList();
|
||||
public List<ParticipationAspect> GetAllByGroup(Guid groupId) =>
|
||||
db.ParticipationAspects.Find(a => a.GroupId == groupId).OrderBy(a => a.SortOrder).ToList();
|
||||
public void Save(ParticipationAspect a)
|
||||
{
|
||||
if (a.GroupId is Guid groupId) ArchivedGroupWriteGuard.EnsureActive(db, groupId);
|
||||
a.Key = a.Key.Trim();
|
||||
a.Label = a.Label.Trim();
|
||||
if (a.Key.Length == 0) throw new ArgumentException("Der Schlüssel darf nicht leer sein.");
|
||||
if (a.Label.Length == 0) throw new ArgumentException("Die Bezeichnung darf nicht leer sein.");
|
||||
// Ein Schlüssel muss innerhalb dessen, was für eine Gruppe tatsächlich gilt, eindeutig
|
||||
// sein — das sind die globalen Standardaspekte UND die gruppenspezifischen zusammen
|
||||
// (siehe ParticipationTabViewModel.LoadAspects, das beide konkateniert). Sonst entstünde
|
||||
// in der Bewertungsübersicht eine mehrdeutige Spalte mit identischem Schlüssel.
|
||||
var relevant = db.ParticipationAspects.Find(x => x.GroupId == null || x.GroupId == a.GroupId);
|
||||
var duplicate = relevant.FirstOrDefault(x =>
|
||||
x.Id != a.Id && string.Equals(x.Key, a.Key, StringComparison.OrdinalIgnoreCase));
|
||||
if (duplicate is not null)
|
||||
throw new InvalidOperationException("Ein Aspekt mit diesem Schlüssel existiert für diese Gruppe bereits.");
|
||||
a.UpdatedAt = DateTime.UtcNow;
|
||||
db.ParticipationAspects.Upsert(a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user