Skip to content

[UPDT] ATTENDANCE: Monthly summary decides how much of a day was worked in one place - #1436

Open
adamsthws wants to merge 1 commit into
horilla:dev/v2.0from
LBS-Sheet-Metal:refactor/summary-day-status
Open

adamsthws wants to merge 1 commit into
horilla:dev/v2.0from
LBS-Sheet-Metal:refactor/summary-day-status

Conversation

@adamsthws

Copy link
Copy Markdown
Contributor

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 against minimum_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

  • Two helpers, used by all six places:
    • 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".
  • The views read the same attendance fields (_CAL_ATTENDANCE_FIELDS).
  • Values that only feed the regular/overtime labels and the half-day leave check keep reading the attendance as before.

Tests

  • attendance/tests/test_day_type.py (4 tests): the rule's edge cases (grace, half, short, missing punch, nothing required).
  • The same test checks that every view (table, calendar, detail popover, absent list, regularise panel) judges a day by day_hours: patched to say "2 of 8 hours", a 9-hour day becomes short in all of them.
  • All existing attendance tests pass unchanged.

Checklist

  • This PR targets dev/v2.0, not 2.0.
  • I've followed the coding conventions in CONTRIBUTING.md (Black + isort via the repo's pre-commit)
  • CI (Docker CI + Quality) passes
  • I've linked any related issues

Related issues

None.

…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant