feat: add group management for workers and shifts, including validation for overlapping groups
This commit is contained in:
@@ -1690,6 +1690,8 @@ def shift_add(request, rota_id):
|
||||
"workers_required": int(data["workers_required"]),
|
||||
"assign_as_block": bool(data["assign_as_block"]),
|
||||
"balance_offset": data.get("balance_offset"),
|
||||
"include_groups": data.get("include_groups", []),
|
||||
"exclude_groups": data.get("exclude_groups", []),
|
||||
"constraints": data.get("constraints", []),
|
||||
}
|
||||
|
||||
@@ -1738,6 +1740,9 @@ def shift_edit(request, rota_id, idx):
|
||||
"days": data["days"],
|
||||
"workers_required": int(data["workers_required"]),
|
||||
"assign_as_block": bool(data["assign_as_block"]),
|
||||
"balance_offset": data.get("balance_offset"),
|
||||
"include_groups": data.get("include_groups", []),
|
||||
"exclude_groups": data.get("exclude_groups", []),
|
||||
"constraints": data.get("constraints", []),
|
||||
}
|
||||
current = rota.shifts or []
|
||||
@@ -1766,6 +1771,8 @@ def shift_edit(request, rota_id, idx):
|
||||
"workers_required": shift.get("workers_required"),
|
||||
"assign_as_block": shift.get("assign_as_block", False),
|
||||
"balance_offset": shift.get("balance_offset", None),
|
||||
"include_groups": ",".join(shift.get("include_groups") or []),
|
||||
"exclude_groups": ",".join(shift.get("exclude_groups") or []),
|
||||
"constraints": json.dumps(shift.get("constraints", [])) if shift.get("constraints") is not None else "",
|
||||
}
|
||||
form = ShiftForm(initial=initial)
|
||||
|
||||
Reference in New Issue
Block a user