Klausurvarianten, Bonuspunkte und Wiederholungen ergänzen

This commit is contained in:
admin committed 2026-09-26 10:42:11 +02:00
1 parent 54ad7f7419
commit 431d023c1a
22 files changed
+522 -40

No files matched your search

@@ -41,12 +41,27 @@ public partial class ExamGradingDialog : Window
Width = new DataGridLength(170, DataGridLengthUnitType.Pixel),
});
if (vm.HasVariants)
grid.Columns.Add(new DataGridTemplateColumn
{
Header = "Fassung", Width = new DataGridLength(82, DataGridLengthUnitType.Pixel),
CellTemplate = new FuncDataTemplate<ExamResultRow>((row, _) =>
{
if (row is null) return new TextBlock();
var choice = new ComboBox { ItemsSource = row.VariantOptions, SelectedItem = row.VariantName };
choice.SelectionChanged += (_, _) => row.VariantName = choice.SelectedItem as string ?? "A";
return choice;
}),
});
for (var i = 0; i < vm.Tasks.Count; i++)
{
var task = vm.Tasks[i];
grid.Columns.Add(new DataGridTemplateColumn
{
Header = string.IsNullOrWhiteSpace(task.Title) ? $"Aufg. {task.Nr}" : $"{task.Nr}. {task.Title}",
Header = (string.IsNullOrWhiteSpace(task.Title) ? $"Aufg. {task.Nr}" : $"{task.Nr}. {task.Title}")
+ (task.Variant is null ? "" : $" ({task.Variant})")
+ (task.IsBonus ? " ★ Bonus" : ""),
Width = new DataGridLength(1, DataGridLengthUnitType.Star),
CellTemplate = BuildPointsCellTemplate(i, grid, vm.Tasks.Count),
});
@@ -91,6 +106,7 @@ public partial class ExamGradingDialog : Window
Background = Brushes.Transparent,
Padding = new Thickness(6, 4),
HorizontalContentAlignment = HorizontalAlignment.Center,
IsEnabled = cell.IsApplicable,
};
ToolTip.SetTip(tb, $"max. {FormatPoints(cell.MaxPoints)} Punkte");
UpdateInvalidVisual(tb, cell.IsInvalid);
@@ -99,6 +115,8 @@ public partial class ExamGradingDialog : Window
{
if (pe.PropertyName == nameof(PointsCell.IsInvalid))
UpdateInvalidVisual(tb, cell.IsInvalid);
if (pe.PropertyName == nameof(PointsCell.IsApplicable))
tb.IsEnabled = cell.IsApplicable;
};
tb.LostFocus += (_, _) => CommitPointsCell(tb, cell);