feat: Bildungsplan-Versionierung für Kompetenzkataloge, vollständig über MCP exponiert
Neue Bildungspläne wachsen je Fach klassenstufenweise hoch, sodass Kurse abhängig vom Einschulungsjahr entweder dem alten oder dem neuen Bildungsplan folgen. CompetencyCatalogVersion (Fach + Name + IsDefault) macht das abbildbar: CompetencyDomain bekommt eine VersionId, Kurse wählen über LearningGroup.CompetencyCatalogVersionId (null = Standardversion des Fachs) welche Version gilt. Migration legt für bestehende Kataloge automatisch eine Standardversion an, damit alte Datenbanken unverändert weiterlaufen. MCP: neue Tools für Versions-CRUD (get/create/update/delete_competency_plan_version, update_group_competency_version), get_competency_catalog/create_competency_domain um optionalen versionId-Parameter erweitert. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ffba35eff
commit
f97edff2fe
45 files changed
+1020
-163
No files matched your search
@@ -13,6 +13,7 @@ public partial class CompetencyOverviewTabViewModel : ObservableObject
|
||||
private readonly IExamRepository _exams;
|
||||
private readonly IExamResultRepository _results;
|
||||
private readonly ICompetencyDomainRepository _catalog;
|
||||
private readonly ICompetencyCatalogVersionRepository _versions;
|
||||
private readonly IStudentRepository _students;
|
||||
private readonly CompetencyAnalysisService _analysis;
|
||||
private LearningGroup? _group;
|
||||
@@ -23,6 +24,7 @@ public partial class CompetencyOverviewTabViewModel : ObservableObject
|
||||
[ObservableProperty] private string _emptyMessage = "";
|
||||
|
||||
public string GroupLabel => _group?.Name ?? "";
|
||||
public string VersionLabel { get; private set; } = "";
|
||||
|
||||
public ObservableCollection<CompetencyStudentOption> StudentOptions { get; } = [];
|
||||
public ObservableCollection<CompetencyOverviewRow> Rows { get; } = [];
|
||||
@@ -32,12 +34,14 @@ public partial class CompetencyOverviewTabViewModel : ObservableObject
|
||||
|
||||
public CompetencyOverviewTabViewModel(IUnitRepository units, IExamRepository exams,
|
||||
IExamResultRepository results, ICompetencyDomainRepository catalog,
|
||||
ICompetencyCatalogVersionRepository versions,
|
||||
IStudentRepository students, CompetencyAnalysisService analysis)
|
||||
{
|
||||
_units = units;
|
||||
_exams = exams;
|
||||
_results = results;
|
||||
_catalog = catalog;
|
||||
_versions = versions;
|
||||
_students = students;
|
||||
_analysis = analysis;
|
||||
}
|
||||
@@ -53,9 +57,18 @@ public partial class CompetencyOverviewTabViewModel : ObservableObject
|
||||
{
|
||||
if (_group is null) return;
|
||||
var selectedStudentId = SelectedStudent?.Id;
|
||||
var domains = _group.SubjectId is Guid subjectId
|
||||
? _catalog.GetBySubjectAndGrade(subjectId, _group.GradeLevel)
|
||||
: [];
|
||||
List<CompetencyDomain> domains;
|
||||
if (_group.SubjectId is Guid subjectId)
|
||||
{
|
||||
var versionId = CompetencyCatalogVersionResolver.Resolve(_versions, subjectId, _group.CompetencyCatalogVersionId);
|
||||
VersionLabel = _versions.GetById(versionId)?.Name ?? "";
|
||||
domains = _catalog.GetBySubjectAndGrade(subjectId, _group.GradeLevel, versionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
VersionLabel = "";
|
||||
domains = [];
|
||||
}
|
||||
var units = _units.GetByGroup(_group.Id);
|
||||
var exams = _exams.GetByGroup(_group.Id);
|
||||
var results = exams.SelectMany(x => _results.GetByExam(x.Id)).ToList();
|
||||
@@ -81,6 +94,7 @@ public partial class CompetencyOverviewTabViewModel : ObservableObject
|
||||
: "";
|
||||
OnPropertyChanged(nameof(HasRows));
|
||||
OnPropertyChanged(nameof(HasStudents));
|
||||
OnPropertyChanged(nameof(VersionLabel));
|
||||
}
|
||||
|
||||
partial void OnSelectedStudentChanged(CompetencyStudentOption? value)
|
||||
|
||||
@@ -19,6 +19,7 @@ public partial class ExamDialogViewModel : ObservableObject
|
||||
private readonly Guid _groupId;
|
||||
private readonly Guid? _subjectId;
|
||||
private readonly int _gradeLevel;
|
||||
private readonly Guid _competencyCatalogVersionId;
|
||||
private readonly GradingSystem _gradingSystem;
|
||||
private readonly Exam? _editingExam;
|
||||
private readonly Exam? _duplicateSource;
|
||||
@@ -63,11 +64,13 @@ public partial class ExamDialogViewModel : ObservableObject
|
||||
public ExamDialogViewModel(IExamRepository exams, ICompetencyDomainRepository competencyDomains,
|
||||
IGradingKeyTemplateRepository gradingKeyTemplates, GradingService grading,
|
||||
Guid groupId, Guid? subjectId, int gradeLevel, GradingSystem gradingSystem,
|
||||
string defaultSubjectName, bool isDifferentiated, Exam? editingExam, Exam? duplicateSource)
|
||||
string defaultSubjectName, bool isDifferentiated, Exam? editingExam, Exam? duplicateSource,
|
||||
Guid competencyCatalogVersionId = default)
|
||||
{
|
||||
_exams = exams; _competencyDomains = competencyDomains;
|
||||
_gradingKeyTemplates = gradingKeyTemplates; _grading = grading;
|
||||
_groupId = groupId; _subjectId = subjectId; _gradeLevel = gradeLevel;
|
||||
_competencyCatalogVersionId = competencyCatalogVersionId;
|
||||
_gradingSystem = gradingSystem;
|
||||
_editingExam = editingExam;
|
||||
_duplicateSource = duplicateSource;
|
||||
@@ -75,7 +78,7 @@ public partial class ExamDialogViewModel : ObservableObject
|
||||
IsDifferentiated = isDifferentiated;
|
||||
|
||||
HasCompetencyCatalog = subjectId.HasValue
|
||||
&& _competencyDomains.GetBySubjectAndGrade(subjectId.Value, gradeLevel).Count > 0;
|
||||
&& _competencyDomains.GetBySubjectAndGrade(subjectId.Value, gradeLevel, competencyCatalogVersionId).Count > 0;
|
||||
|
||||
foreach (var t in _gradingKeyTemplates.GetByGradingSystem(gradingSystem))
|
||||
AvailableTemplates.Add(t);
|
||||
@@ -164,7 +167,7 @@ public partial class ExamDialogViewModel : ObservableObject
|
||||
var groups = new List<CompetencyTagGroup>();
|
||||
if (!_subjectId.HasValue) return groups;
|
||||
var selected = selectedCodes.ToHashSet();
|
||||
foreach (var domain in _competencyDomains.GetBySubjectAndGrade(_subjectId.Value, _gradeLevel))
|
||||
foreach (var domain in _competencyDomains.GetBySubjectAndGrade(_subjectId.Value, _gradeLevel, _competencyCatalogVersionId))
|
||||
{
|
||||
var group = new CompetencyTagGroup(domain.Name, domain.Code);
|
||||
foreach (var item in domain.Items.OrderBy(i => i.SortOrder))
|
||||
|
||||
@@ -799,8 +799,10 @@ public partial class AddGroupDialogViewModel : ObservableObject
|
||||
{
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly ISubjectRepository _subjects;
|
||||
private readonly ICompetencyCatalogVersionRepository _competencyVersions;
|
||||
private List<Subject> _allSubjects = [];
|
||||
private LearningGroup? _editingGroup;
|
||||
private Guid? _pendingCompetencyVersionId;
|
||||
|
||||
public List<string> TypeOptions { get; } = ["Klasse", "Kurs"];
|
||||
[ObservableProperty] private string _selectedTypeName = "Kurs";
|
||||
@@ -829,18 +831,21 @@ public partial class AddGroupDialogViewModel : ObservableObject
|
||||
[ObservableProperty] private bool _excludedFromUntisHub;
|
||||
[ObservableProperty] private string _nameError = "";
|
||||
[ObservableProperty] private string _gradeLevelError = "";
|
||||
[ObservableProperty] private CompetencyVersionListItem? _selectedCompetencyVersion;
|
||||
|
||||
public List<string> SchoolYears { get; }
|
||||
public List<string> GradingOptions { get; } = ["Noten 1–6", "Punkte 0–15"];
|
||||
public List<string> KnownSubjectNames { get; private set; } = [];
|
||||
public ObservableCollection<CompetencyVersionListItem> AvailableCompetencyVersions { get; } = [];
|
||||
public bool HasCompetencyVersionChoice => AvailableCompetencyVersions.Count > 0;
|
||||
public LearningGroup? Result { get; private set; }
|
||||
public string DialogTitle => _editingGroup is null ? "Neue Lerngruppe anlegen" : "Lerngruppe bearbeiten";
|
||||
public string SaveButtonText => _editingGroup is null ? "Anlegen" : "Speichern";
|
||||
|
||||
public AddGroupDialogViewModel(IGroupRepository groups, ISubjectRepository subjects,
|
||||
SchoolYearService sy)
|
||||
ICompetencyCatalogVersionRepository competencyVersions, SchoolYearService sy)
|
||||
{
|
||||
_groups = groups; _subjects = subjects;
|
||||
_groups = groups; _subjects = subjects; _competencyVersions = competencyVersions;
|
||||
_allSubjects = subjects.GetAll();
|
||||
KnownSubjectNames = _allSubjects.Select(s => s.Name).ToList();
|
||||
SchoolYears = sy.RecentSchoolYears(3);
|
||||
@@ -852,11 +857,40 @@ public partial class AddGroupDialogViewModel : ObservableObject
|
||||
};
|
||||
}
|
||||
|
||||
partial void OnSubjectChanged(string value) => LoadCompetencyVersions();
|
||||
|
||||
/// <summary>Baut die Versionsliste für das aktuell im Freitextfeld <see cref="Subject"/> erkannte
|
||||
/// Fach neu auf. Ein neues, noch nicht angelegtes Fach hat noch keine Versionen - die Auswahl
|
||||
/// bleibt dann leer (<see cref="HasCompetencyVersionChoice"/> blendet den Picker aus), der Kurs
|
||||
/// bekommt beim Speichern automatisch die Standardversion, sobald das Fach existiert.</summary>
|
||||
private void LoadCompetencyVersions()
|
||||
{
|
||||
var targetId = _pendingCompetencyVersionId ?? SelectedCompetencyVersion?.Id;
|
||||
_pendingCompetencyVersionId = null;
|
||||
AvailableCompetencyVersions.Clear();
|
||||
|
||||
var subjectName = Subject.Trim();
|
||||
var subject = subjectName.Length == 0 ? null : _allSubjects.FirstOrDefault(
|
||||
s => s.Name.Equals(subjectName, StringComparison.OrdinalIgnoreCase));
|
||||
if (subject is not null)
|
||||
{
|
||||
var versions = _competencyVersions.GetBySubject(subject.Id);
|
||||
if (versions.Count == 0) versions = [_competencyVersions.GetOrCreateDefault(subject.Id)];
|
||||
foreach (var v in versions) AvailableCompetencyVersions.Add(new CompetencyVersionListItem(v));
|
||||
}
|
||||
|
||||
SelectedCompetencyVersion = AvailableCompetencyVersions.FirstOrDefault(v => v.Id == targetId)
|
||||
?? AvailableCompetencyVersions.FirstOrDefault(v => v.IsDefault)
|
||||
?? AvailableCompetencyVersions.FirstOrDefault();
|
||||
OnPropertyChanged(nameof(HasCompetencyVersionChoice));
|
||||
}
|
||||
|
||||
public void LoadForEdit(LearningGroup group)
|
||||
{
|
||||
_editingGroup = group;
|
||||
SelectedTypeName = group.Type == GroupType.Class ? "Klasse" : "Kurs";
|
||||
Name = group.Name;
|
||||
_pendingCompetencyVersionId = group.CompetencyCatalogVersionId;
|
||||
Subject = group.SubjectId is Guid subjectId ? _subjects.GetById(subjectId)?.Name ?? "" : "";
|
||||
GradeLevel = group.GradeLevel;
|
||||
SelectedGradingName = group.GradingSystem == GradingSystem.Grades1To6
|
||||
@@ -905,6 +939,7 @@ public partial class AddGroupDialogViewModel : ObservableObject
|
||||
Result = _editingGroup ?? new LearningGroup();
|
||||
Result.Name = Name.Trim();
|
||||
Result.SubjectId = subjectId;
|
||||
Result.CompetencyCatalogVersionId = subjectId is null ? null : SelectedCompetencyVersion?.Id;
|
||||
Result.Type = IsKurs ? GroupType.Course : GroupType.Class;
|
||||
Result.GradeLevel = GradeLevel;
|
||||
Result.GradingSystem = SelectedGradingName == "Punkte 0–15"
|
||||
@@ -919,3 +954,13 @@ public partial class AddGroupDialogViewModel : ObservableObject
|
||||
_groups.Save(Result);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Anzeige-Wrapper für den Bildungsplan-Versions-Picker im Kursdialog, analog zu
|
||||
/// <see cref="SubjectListItem"/>.</summary>
|
||||
public sealed class CompetencyVersionListItem(CompetencyCatalogVersion v)
|
||||
{
|
||||
public Guid Id { get; } = v.Id;
|
||||
public string Name { get; } = v.Name;
|
||||
public bool IsDefault { get; } = v.IsDefault;
|
||||
public string DisplayName => IsDefault ? $"{Name} (Standard)" : Name;
|
||||
}
|
||||
@@ -19,11 +19,13 @@ public partial class ParticipationTabViewModel : ObservableObject
|
||||
private readonly IGroupMembershipRepository _memberships;
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly ICompetencyDomainRepository _competencyDomains;
|
||||
private readonly ICompetencyCatalogVersionRepository _competencyVersions;
|
||||
|
||||
private Guid _groupId;
|
||||
private string _schoolYear = "";
|
||||
private Guid? _subjectId;
|
||||
private int _gradeLevel;
|
||||
private Guid _competencyCatalogVersionId;
|
||||
private GradingSystem _gradingSystem;
|
||||
|
||||
public Guid GroupId => _groupId;
|
||||
@@ -63,12 +65,14 @@ public partial class ParticipationTabViewModel : ObservableObject
|
||||
IStudentRepository students,
|
||||
IGroupMembershipRepository memberships,
|
||||
IGroupRepository groups,
|
||||
ICompetencyDomainRepository competencyDomains)
|
||||
ICompetencyDomainRepository competencyDomains,
|
||||
ICompetencyCatalogVersionRepository competencyVersions)
|
||||
{
|
||||
_sessions = sessions; _entries = entries;
|
||||
_aspects = aspects; _students = students;
|
||||
_memberships = memberships; _groups = groups;
|
||||
_competencyDomains = competencyDomains;
|
||||
_competencyVersions = competencyVersions;
|
||||
}
|
||||
|
||||
public void Initialize(Guid groupId, string schoolYear, bool isReadOnly = false)
|
||||
@@ -80,11 +84,13 @@ public partial class ParticipationTabViewModel : ObservableObject
|
||||
var group = _groups.GetById(groupId);
|
||||
_subjectId = group?.SubjectId;
|
||||
_gradeLevel = group?.GradeLevel ?? 0;
|
||||
_competencyCatalogVersionId = CompetencyCatalogVersionResolver.Resolve(
|
||||
_competencyVersions, _subjectId, group?.CompetencyCatalogVersionId);
|
||||
_gradingSystem = group?.GradingSystem ?? GradingSystem.Grades1To6;
|
||||
GroupLabel = group?.Name ?? "";
|
||||
|
||||
HasCompetencyCatalog = _subjectId.HasValue
|
||||
&& _competencyDomains.GetBySubjectAndGrade(_subjectId.Value, _gradeLevel).Count > 0;
|
||||
&& _competencyDomains.GetBySubjectAndGrade(_subjectId.Value, _gradeLevel, _competencyCatalogVersionId).Count > 0;
|
||||
|
||||
LoadAspects();
|
||||
LoadSessions();
|
||||
@@ -236,7 +242,7 @@ public partial class ParticipationTabViewModel : ObservableObject
|
||||
if (!_subjectId.HasValue) return;
|
||||
var active = ActiveCompetencyCodes.ToHashSet();
|
||||
|
||||
foreach (var domain in _competencyDomains.GetBySubjectAndGrade(_subjectId.Value, _gradeLevel))
|
||||
foreach (var domain in _competencyDomains.GetBySubjectAndGrade(_subjectId.Value, _gradeLevel, _competencyCatalogVersionId))
|
||||
{
|
||||
var group = new CompetencyTagGroup(domain.Name, domain.Code);
|
||||
foreach (var item in domain.Items.OrderBy(i => i.SortOrder))
|
||||
|
||||
@@ -34,6 +34,7 @@ public partial class PlanningTabViewModel : ObservableObject
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly ISubjectRepository _subjects;
|
||||
private readonly ICompetencyDomainRepository _competencyDomains;
|
||||
private readonly ICompetencyCatalogVersionRepository _competencyVersions;
|
||||
private readonly AiSettingsService _aiSettings;
|
||||
private readonly IParticipationSessionRepository _participationSessions;
|
||||
|
||||
@@ -44,6 +45,9 @@ public partial class PlanningTabViewModel : ObservableObject
|
||||
public int GradeLevel { get; private set; }
|
||||
public string SubjectName { get; private set; } = "";
|
||||
public string GroupLabel { get; private set; } = "";
|
||||
/// <summary>Aufgelöste Bildungsplan-Version dieser Gruppe (Gruppenwahl, sonst Standardversion des
|
||||
/// Fachs) - <see cref="Guid.Empty"/> ohne Fach.</summary>
|
||||
public Guid CompetencyCatalogVersionId { get; private set; }
|
||||
|
||||
[ObservableProperty] private UnitSummary? _selectedUnit;
|
||||
[ObservableProperty] private LessonSummary? _selectedLesson;
|
||||
@@ -85,11 +89,12 @@ public partial class PlanningTabViewModel : ObservableObject
|
||||
|
||||
public PlanningTabViewModel(IUnitRepository units, ILessonRepository lessons,
|
||||
IGroupRepository groups, ISubjectRepository subjects,
|
||||
ICompetencyDomainRepository competencyDomains, AiSettingsService aiSettings,
|
||||
IParticipationSessionRepository participationSessions)
|
||||
ICompetencyDomainRepository competencyDomains, ICompetencyCatalogVersionRepository competencyVersions,
|
||||
AiSettingsService aiSettings, IParticipationSessionRepository participationSessions)
|
||||
{
|
||||
_units = units; _lessons = lessons; _groups = groups;
|
||||
_subjects = subjects; _competencyDomains = competencyDomains;
|
||||
_competencyVersions = competencyVersions;
|
||||
_aiSettings = aiSettings; _participationSessions = participationSessions;
|
||||
}
|
||||
|
||||
@@ -102,6 +107,8 @@ public partial class PlanningTabViewModel : ObservableObject
|
||||
GradeLevel = group?.GradeLevel ?? 0;
|
||||
SubjectName = SubjectId is Guid sid ? _subjects.GetById(sid)?.Name ?? "" : "";
|
||||
GroupLabel = group?.Name ?? "";
|
||||
CompetencyCatalogVersionId = CompetencyCatalogVersionResolver.Resolve(
|
||||
_competencyVersions, SubjectId, group?.CompetencyCatalogVersionId);
|
||||
LoadUnits(preferActive: true);
|
||||
}
|
||||
|
||||
@@ -577,6 +584,7 @@ public partial class UnitDialogViewModel : ObservableObject
|
||||
private readonly Guid _groupId;
|
||||
private readonly Guid? _subjectId;
|
||||
private readonly int _gradeLevel;
|
||||
private readonly Guid _competencyCatalogVersionId;
|
||||
private readonly Unit? _editingUnit;
|
||||
private readonly List<string> _competencyCodes;
|
||||
|
||||
@@ -620,10 +628,12 @@ public partial class UnitDialogViewModel : ObservableObject
|
||||
}
|
||||
|
||||
public UnitDialogViewModel(IUnitRepository units, ICompetencyDomainRepository competencyDomains,
|
||||
Guid groupId, Guid? subjectId, int gradeLevel, string groupName, string subjectName, Unit? editingUnit)
|
||||
Guid groupId, Guid? subjectId, int gradeLevel, string groupName, string subjectName, Unit? editingUnit,
|
||||
Guid competencyCatalogVersionId = default)
|
||||
{
|
||||
_units = units; _competencyDomains = competencyDomains;
|
||||
_groupId = groupId; _subjectId = subjectId; _gradeLevel = gradeLevel;
|
||||
_competencyCatalogVersionId = competencyCatalogVersionId;
|
||||
_editingUnit = editingUnit;
|
||||
GroupSubjectDisplay = string.IsNullOrWhiteSpace(subjectName)
|
||||
? $"{groupName} · kein Fach hinterlegt (siehe Lerngruppe)" : $"{groupName} · {subjectName}";
|
||||
@@ -646,7 +656,7 @@ public partial class UnitDialogViewModel : ObservableObject
|
||||
CompetencyTagGroups.Clear();
|
||||
if (!_subjectId.HasValue) return;
|
||||
var selected = _competencyCodes.ToHashSet();
|
||||
foreach (var domain in _competencyDomains.GetBySubjectAndGrade(_subjectId.Value, _gradeLevel))
|
||||
foreach (var domain in _competencyDomains.GetBySubjectAndGrade(_subjectId.Value, _gradeLevel, _competencyCatalogVersionId))
|
||||
{
|
||||
var group = new CompetencyTagGroup(domain.Name, domain.Code);
|
||||
foreach (var item in domain.Items.OrderBy(i => i.SortOrder))
|
||||
|
||||
@@ -22,39 +22,97 @@ public partial class SettingsViewModel
|
||||
|
||||
[ObservableProperty] private SubjectListItem? _catalogSubject;
|
||||
[ObservableProperty] private int _catalogGradeLevel = 10;
|
||||
[ObservableProperty] private CompetencyCatalogVersion? _catalogVersion;
|
||||
[ObservableProperty] private string _newDomainName = "";
|
||||
[ObservableProperty] private string _newDomainCode = "";
|
||||
[ObservableProperty] private string _catalogValidation = "";
|
||||
[ObservableProperty] private string _newVersionName = "";
|
||||
[ObservableProperty] private string _versionValidation = "";
|
||||
|
||||
public ObservableCollection<DomainEditItem> Domains { get; } = [];
|
||||
public ObservableCollection<CompetencyCatalogVersion> CatalogVersions { get; } = [];
|
||||
|
||||
// ── Katalog: Laden ────────────────────────────────────────────────────────
|
||||
|
||||
partial void OnCatalogSubjectChanged(SubjectListItem? value) => LoadCatalog();
|
||||
partial void OnCatalogSubjectChanged(SubjectListItem? value) => LoadVersions();
|
||||
partial void OnCatalogGradeLevelChanged(int value) => LoadCatalog();
|
||||
partial void OnCatalogVersionChanged(CompetencyCatalogVersion? value) => LoadCatalog();
|
||||
|
||||
private void LoadVersions()
|
||||
{
|
||||
var selectedId = CatalogVersion?.Id;
|
||||
CatalogVersions.Clear();
|
||||
if (CatalogSubject is null) { LoadCatalog(); return; }
|
||||
foreach (var v in _versionRepo.GetBySubject(CatalogSubject.Id))
|
||||
CatalogVersions.Add(v);
|
||||
if (CatalogVersions.Count == 0)
|
||||
CatalogVersions.Add(_versionRepo.GetOrCreateDefault(CatalogSubject.Id));
|
||||
CatalogVersion = CatalogVersions.FirstOrDefault(v => v.Id == selectedId)
|
||||
?? CatalogVersions.FirstOrDefault(v => v.IsDefault)
|
||||
?? CatalogVersions.FirstOrDefault();
|
||||
}
|
||||
|
||||
private void LoadCatalog()
|
||||
{
|
||||
Domains.Clear();
|
||||
CatalogValidation = "";
|
||||
if (CatalogSubject is null) return;
|
||||
foreach (var d in _domainRepo.GetBySubjectAndGrade(CatalogSubject.Id, CatalogGradeLevel))
|
||||
if (CatalogSubject is null || CatalogVersion is null) return;
|
||||
foreach (var d in _domainRepo.GetBySubjectAndGrade(CatalogSubject.Id, CatalogGradeLevel, CatalogVersion.Id))
|
||||
Domains.Add(CreateDomainEditItem(d));
|
||||
RefreshDomainMoveState();
|
||||
}
|
||||
|
||||
// ── Versionen (Bildungspläne) verwalten ──────────────────────────────────
|
||||
|
||||
[RelayCommand]
|
||||
private void AddCatalogVersion()
|
||||
{
|
||||
if (CatalogSubject is null) { VersionValidation = "Bitte zuerst ein Fach auswählen."; return; }
|
||||
if (string.IsNullOrWhiteSpace(NewVersionName)) { VersionValidation = "Name der Version erforderlich."; return; }
|
||||
|
||||
var version = new CompetencyCatalogVersion
|
||||
{
|
||||
SubjectId = CatalogSubject.Id, Name = NewVersionName.Trim(),
|
||||
SortOrder = CatalogVersions.Count,
|
||||
};
|
||||
_versionRepo.Save(version);
|
||||
CatalogVersions.Add(version);
|
||||
CatalogVersion = version;
|
||||
NewVersionName = ""; VersionValidation = "";
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SetCatalogVersionAsDefault(CompetencyCatalogVersion? version)
|
||||
{
|
||||
if (version is null || CatalogSubject is null) return;
|
||||
version.IsDefault = true;
|
||||
_versionRepo.Save(version);
|
||||
LoadVersions();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void DeleteCatalogVersion(CompetencyCatalogVersion? version)
|
||||
{
|
||||
if (version is null) return;
|
||||
try { _versionRepo.Delete(version.Id); }
|
||||
catch (InvalidOperationException ex) { VersionValidation = ex.Message; return; }
|
||||
LoadVersions();
|
||||
}
|
||||
|
||||
// ── Katalog: Bereich hinzufügen / löschen ────────────────────────────────
|
||||
|
||||
[RelayCommand]
|
||||
private void AddDomain()
|
||||
{
|
||||
if (CatalogSubject is null) { CatalogValidation = "Bitte zuerst ein Fach auswählen."; return; }
|
||||
if (CatalogVersion is null) { CatalogValidation = "Bitte zuerst eine Version auswählen."; return; }
|
||||
if (string.IsNullOrWhiteSpace(NewDomainName)) { CatalogValidation = "Bereichsname erforderlich."; return; }
|
||||
|
||||
var domain = new CompetencyDomain
|
||||
{
|
||||
SubjectId = CatalogSubject.Id,
|
||||
GradeLevel = CatalogGradeLevel,
|
||||
VersionId = CatalogVersion.Id,
|
||||
Name = NewDomainName.Trim(),
|
||||
Code = NewDomainCode.Trim(),
|
||||
SortOrder = Domains.Count,
|
||||
|
||||
@@ -27,11 +27,16 @@ public partial class SettingsViewModel
|
||||
CatalogValidation = "Bitte zuerst ein Fach auswählen.";
|
||||
return null;
|
||||
}
|
||||
if (CatalogVersion is null)
|
||||
{
|
||||
CatalogValidation = "Bitte zuerst eine Version auswählen.";
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
CatalogValidation = "";
|
||||
return _catalogImport.Analyze(
|
||||
json, CatalogSubject.Id, CatalogSubject.Name, CatalogGradeLevel);
|
||||
json, CatalogSubject.Id, CatalogSubject.Name, CatalogGradeLevel, CatalogVersion.Id);
|
||||
}
|
||||
catch (InvalidDataException ex)
|
||||
{
|
||||
@@ -71,9 +76,15 @@ public partial class SettingsViewModel
|
||||
return null;
|
||||
}
|
||||
|
||||
if (CatalogVersion is null)
|
||||
{
|
||||
CatalogValidation = "Bitte zuerst eine Version auswählen.";
|
||||
return null;
|
||||
}
|
||||
|
||||
CatalogValidation = "";
|
||||
return _catalogImport.Analyze(SerializeCatalog(targetGradeLevel), CatalogSubject.Id,
|
||||
CatalogSubject.Name, targetGradeLevel);
|
||||
CatalogSubject.Name, targetGradeLevel, CatalogVersion.Id);
|
||||
}
|
||||
|
||||
public void SetCatalogCopyStatus(int targetGradeLevel) =>
|
||||
|
||||
@@ -49,6 +49,7 @@ public partial class SettingsViewModel : ObservableObject
|
||||
{
|
||||
private readonly ISubjectRepository _subjects;
|
||||
private readonly ICompetencyDomainRepository _domainRepo;
|
||||
private readonly ICompetencyCatalogVersionRepository _versionRepo;
|
||||
private readonly IGradingKeyTemplateRepository _gradingKeyTemplates;
|
||||
private readonly IGradingSchemeRepository _gradingSchemes;
|
||||
private readonly GradingService _grading;
|
||||
@@ -95,6 +96,7 @@ public partial class SettingsViewModel : ObservableObject
|
||||
public TrashViewModel TrashTab { get; }
|
||||
|
||||
public SettingsViewModel(ISubjectRepository subjects, ICompetencyDomainRepository domainRepo,
|
||||
ICompetencyCatalogVersionRepository versionRepo,
|
||||
IGradingKeyTemplateRepository gradingKeyTemplates, IGradingSchemeRepository gradingSchemes,
|
||||
GradingService grading, BackupService backups, BackupSettingsService backupSettings,
|
||||
DatabaseEncryptionService dbEncryption,
|
||||
@@ -123,6 +125,7 @@ public partial class SettingsViewModel : ObservableObject
|
||||
TrashTab = trashTab;
|
||||
_subjects = subjects;
|
||||
_domainRepo = domainRepo;
|
||||
_versionRepo = versionRepo;
|
||||
_gradingKeyTemplates = gradingKeyTemplates;
|
||||
_gradingSchemes = gradingSchemes;
|
||||
_grading = grading;
|
||||
|
||||
Reference in new issue
Block a user