UI verbessert
This commit is contained in:
1 parent
cc2e85c111
commit
a5d4251868
10 files changed
+136
-83
No files matched your search
@@ -130,7 +130,7 @@ func TestPlannerTreatsHighFeastAsSunday(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCandidateSuggestionsMarkBeyondPreferences(t *testing.T) {
|
||||
func TestCandidateSuggestionsAllowPreferenceOverrides(t *testing.T) {
|
||||
service := ServiceOccurrence{
|
||||
ID: "s1", ChurchID: "c1", Date: MustDate("2026-11-16"),
|
||||
TimeMinutes: 18 * 60, Title: "Abendmesse", LectorsNeeded: 1,
|
||||
@@ -140,14 +140,17 @@ func TestCandidateSuggestionsMarkBeyondPreferences(t *testing.T) {
|
||||
PreferredWeekdays: []int{1}, Active: true, MaxPerMonth: 6,
|
||||
}
|
||||
suggestions := CandidateSuggestions(service, RoleLector,
|
||||
[]Person{sundayOnly}, nil, nil, []ServiceOccurrence{service}, nil, false, nil)
|
||||
if len(suggestions) != 1 || !suggestions[0].Blocked || suggestions[0].BeyondPreferences {
|
||||
t.Fatalf("person without permission should be blocked, got %#v", suggestions)
|
||||
[]Person{sundayOnly}, nil, nil, []ServiceOccurrence{service}, nil, nil)
|
||||
if len(suggestions) != 1 || suggestions[0].Blocked || !suggestions[0].BeyondPreferences {
|
||||
t.Fatalf("manual suggestions should allow preference overrides with a warning, got %#v", suggestions)
|
||||
}
|
||||
if len(suggestions[0].Warnings) == 0 {
|
||||
t.Fatal("preference override should carry a warning")
|
||||
}
|
||||
|
||||
sundayOnly.AllowBeyondPreferences = true
|
||||
suggestions = CandidateSuggestions(service, RoleLector,
|
||||
[]Person{sundayOnly}, nil, nil, []ServiceOccurrence{service}, nil, false, nil)
|
||||
[]Person{sundayOnly}, nil, nil, []ServiceOccurrence{service}, nil, nil)
|
||||
if len(suggestions) != 1 || suggestions[0].Blocked || !suggestions[0].BeyondPreferences {
|
||||
t.Fatalf("flagged person should be suggested beyond preferences, got %#v", suggestions)
|
||||
}
|
||||
@@ -155,3 +158,23 @@ func TestCandidateSuggestionsMarkBeyondPreferences(t *testing.T) {
|
||||
t.Fatal("unexpected preference note")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCandidateSuggestionsBlockAbsences(t *testing.T) {
|
||||
service := ServiceOccurrence{
|
||||
ID: "s1", ChurchID: "c1", Date: MustDate("2026-11-16"),
|
||||
TimeMinutes: 18 * 60, Title: "Abendmesse", LectorsNeeded: 1,
|
||||
}
|
||||
person := Person{
|
||||
ID: "p1", FirstName: "Anna", LastName: "Berg", Roles: []Role{RoleLector},
|
||||
PreferredWeekdays: []int{1}, Active: true, MaxPerMonth: 6,
|
||||
}
|
||||
absences := []Absence{{
|
||||
ID: "a1", PersonID: person.ID,
|
||||
Start: MustDate("2026-11-16"), End: MustDate("2026-11-16"),
|
||||
}}
|
||||
suggestions := CandidateSuggestions(service, RoleLector,
|
||||
[]Person{person}, absences, nil, []ServiceOccurrence{service}, nil, nil)
|
||||
if len(suggestions) != 1 || !suggestions[0].Blocked {
|
||||
t.Fatalf("absence must remain a hard block, got %#v", suggestions)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user