Repository navigation
feat: editable calendar with rule-checked edits, undo and PDF export - #6
Merged
Merged
Conversation
Add ScheduleEditor for adding, removing and replacing employees on a generated schedule. Every change is checked with Employee's own scheduler rules (skill, capacity, one shift per day, rest time) plus "already assigned" and "fully staffed"; a refused change raises ScheduleEditError with all reasons and leaves the schedule unchanged. Edits are recorded as commands with list positions, so undo restores the exact previous state. Also adds calendar grouping and Danish rule descriptions for the GUI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Export the schedule with ReportLab: period, print time, number of manual changes, all shifts (missing staff highlighted) and employee workload. An existing file is only replaced when the caller allows it, and the PDF is written to a temporary file and moved into place, so a failed export never damages an existing file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a "Kalender" tab (dates x day/evening/night) where a shift can be selected and employees added, removed or replaced through the ScheduleEditor. Candidates show why they cannot take a shift, refused changes show every reason, and all tabs refresh after a change. Undo is available as a button and Ctrl+Z with a change history. "Eksportér PDF" uses the save dialog's overwrite confirmation. Regenerating the plan asks first when there are manual changes; the CSV files are never written. The default window is slightly larger so a week fits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Let a planner correct a generated schedule by hand without breaking the rules the scheduler follows, undo mistakes, and hand out the result as a PDF. Calendar view and PDF export were listed as planned features.
Implementation
app/schedule_editor.py(no Tk): add, remove and replace employees on a shift. Validation reusesEmployee.get_shift_blockers(skill, capacity, one shift per day, rest time) plus "already assigned" and "fully staffed". A refused change raisesScheduleEditErrorwith all reasons and changes nothing. A replacement is checked as if the current employee had left.app/calendar_view.py: "Kalender" tab with a dates × Dag/Aften/Nat grid and staffing colours. The edit panel lists every employee, with Danish reasons for those who cannot take the shift. A change history sits under the calendar; undo is available as a button and Ctrl+Z. The other tabs refresh after each change.app/pdf_export.py(ReportLab, BSD): period, print time, number of manual changes, all shifts (missing staff highlighted) and an employee workload table. It refuses to overwrite unless allowed (the GUI allows it only after the save dialog'sconfirmoverwrite), and writes atomically via a temp file andos.replace.reportlab>=5.1,<6(requirements.txt).Testing
python -m pytest: 72 passed (24 new: 19 editor, 5 PDF). The tests don't import Tkinter.invoke(); only the modal dialogs were stubbed.docs/images/.Not covered
docs/PROJECT_WALKTHROUGH.md.🤖 Generated with Claude Code