Skip to content

Show remaining days alongside absences - #49

Merged
karlitschek merged 2 commits into
mainfrom
feat/noid/show-remaining-days-with-absences
Aug 12, 2026
Merged

Show remaining days alongside absences#49
karlitschek merged 2 commits into
mainfrom
feat/noid/show-remaining-days-with-absences

Conversation

@karlitschek

Copy link
Copy Markdown
Member

The Absences view says how many days somebody took and nothing about how many they have left. The sidebar it opens says no more — so the only way to answer the obvious follow-up was to abandon the view for the Balances report and come back.

Two places, one figure

The right-hand sidebar now shows the balance among the other facts:

Balance 2026
22 days left
of 28 days · 6 days taken
3 days awaiting a decision, leaving 19 days free to book

The headline is what's left; the workings sit under it. Pending days get their own line because they are precisely the difference between what is left and what is safe to book — the distinction that makes a balance actionable rather than just a number. The sidebar opens from Absences, Approvals, Team and My leave, so this covers all four.

The Absences rows carry the same figure inline: 2–4 Mar · 3 days · 22 days left.

Details worth flagging

The year is the one the leave starts in, not the current one. Usage is attributed the same way in BalanceService, and reporting this year's allowance beside last year's leave would describe something else entirely.

Permission-gated. canViewBalanceOf() — the same rule the balance endpoints use — so a colleague who may read a request still cannot read the allowance behind it. The lookup is skipped entirely when they may not.

Null where the question has no answer. Unpaid and special leave count against nothing, so there is no "left" to report and the block is absent rather than showing zeroes.

One query batch, not one per row. The list uses a single balances report per reload, indexed by employee and type — getBalancesForEmployees() computes the lot in a fixed number of queries, which a request per visible absence would not. With the year filter on "All years" there is no single answer, so the rows omit it.

Testing

177 tests, 497 assertions, 0 failures (3 new): that the detail carries the right year's figures, that it is withheld from someone who may not see the allowance, and that a non-counting type yields null. eslint 0 errors, stylelint clean, 27/27 vitest, build succeeds.

RequestServiceTest's service construction moved into a rebuildService() helper, so a test can reprogram a collaborator with expects() before the constructor is handed it.

Note

I could not see the screenshot referenced in the report, so I worked from the code. If by "the right hand side overview" you meant something other than the request sidebar — the stat tiles above the Balances table, say — tell me and I will follow up.

🤖 Generated with Claude Code

Frank Karlitschek and others added 2 commits August 12, 2026 16:33
The Absences view says how many days somebody took and nothing about how many
they have left, and the sidebar it opens says no more — so the only way to answer
the obvious follow-up was to abandon the view for the Balances report and come
back.

Request detail now carries the employee's balance for that leave type in the year
the leave starts — that year, not the current one, because usage is attributed
the same way, and reporting this year's allowance beside last year's leave would
describe something else entirely. Null for a type that counts against nothing,
where "how many are left" has no answer.

Gated on canViewBalanceOf(), the same rule the balance endpoints use, so a
colleague who may read a request still cannot read the allowance behind it.

The sidebar shows it as a headline number with the workings under it — "22 days
left, of 28 days · 6 days taken" — and names what is still awaiting a decision,
since pending days are the difference between what is left and what is safe to
book. The Absences rows carry the same figure inline, from one batched report per
reload rather than a lookup per row; with the year filter on "All years" there is
no single answer, so the rows simply omit it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Aug 12, 2026
@karlitschek
karlitschek merged commit dbc26d8 into main Aug 12, 2026
29 of 35 checks passed
@karlitschek
karlitschek deleted the feat/noid/show-remaining-days-with-absences branch August 12, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants