Repository navigation
Conversation
…ed in one place The summary table, the calendar, the detail popover (present, absent and conflict lists) and the regularise panel each repeated the same rule: time at work against minimum_hour, less the grace time, gives a full, half or short day (or a missing punch with no clock-out). It is now one pair of helpers, day_hours (the hours a day is judged by) and day_type (the rule), so the views can't drift apart and a deployment that keeps minimum_hour for something else can judge days its own way in one place. The views read the same attendance fields. No change in behaviour; with tests.
This branch has not been deployed
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.
Problem
The Monthly Attendance Summary decides how much of a day was worked in six places: the table (
build_monthly_summary), the calendar, the detail popover's present, absent and conflict lists, and the regularise panel. Each repeats the same rule: time at work againstminimum_hour, less the grace time, gives a full, half or short day, or a missing punch when there is no clock-out. Six copies can drift apart, and a deployment that needs to judge days differently has six places to change.Change
day_hours(row): the(worked, required)seconds a day is judged by.day_type(worked, required, grace, clocked_out): the rule, giving "full", "half", "short" or "mo"._CAL_ATTENDANCE_FIELDS).Tests
attendance/tests/test_day_type.py(4 tests): the rule's edge cases (grace, half, short, missing punch, nothing required).day_hours: patched to say "2 of 8 hours", a 9-hour day becomes short in all of them.Checklist
dev/v2.0, not2.0.Related issues
None.