feat: add exact shifts functionality to Worker class and update related logic in RotaBuilder

This commit is contained in:
Ross
2026-07-08 22:33:33 +01:00
parent 02598cb665
commit 0f31dfe1a9
7 changed files with 398 additions and 102 deletions
+3
View File
@@ -45,6 +45,7 @@ class WorkerForm(forms.ModelForm):
# Complex structured options edited as JSON
assign_as_block_preferences = forms.CharField(required=False, widget=forms.Textarea, help_text="JSON mapping shift_name->weight", label="Block preferences (JSON)")
shift_fte_overrides = forms.CharField(required=False, widget=forms.Textarea, help_text="JSON mapping shift_name->fte", label="Shift FTE overrides (JSON)")
exact_shifts = forms.CharField(required=False, widget=forms.Textarea, help_text="JSON mapping shift_name->exact_count", label="Exact shifts (JSON)")
previous_shifts = forms.CharField(required=False, widget=forms.Textarea, help_text="Free JSON structure for previous shifts", label="Previous shifts (JSON)")
shift_balance_extra = forms.CharField(required=False, widget=forms.Textarea, help_text="JSON structure for extra shift-balance penalties", label="Shift balance extra (JSON)")
allowed_multi_shift_sets = forms.CharField(required=False, widget=forms.Textarea, help_text="JSON list of sets (e.g. [[\"a\",\"b\"], ...])", label="Allowed multi-shift sets (JSON)")
@@ -94,6 +95,7 @@ class WorkerForm(forms.ModelForm):
for json_fld in [
"assign_as_block_preferences",
"shift_fte_overrides",
"exact_shifts",
"previous_shifts",
"shift_balance_extra",
"allowed_multi_shift_sets",
@@ -146,6 +148,7 @@ class WorkerForm(forms.ModelForm):
json_fields = [
"assign_as_block_preferences",
"shift_fte_overrides",
"exact_shifts",
"previous_shifts",
"shift_balance_extra",
"allowed_multi_shift_sets",
+1
View File
@@ -229,6 +229,7 @@ class Worker(models.Model):
"max_shifts_per_week_by_shift_name",
"assign_as_block_preferences",
"shift_fte_overrides",
"exact_shifts",
]
list_keys = [
"oop",