Skip to content

feat(leave): set the leave break with --less, and keep a partial day's window on update - #102

Open
bradystroud wants to merge 1 commit into
mainfrom
feat/leave-less-override
Open

bradystroud wants to merge 1 commit into
mainfrom
feat/leave-less-override

Conversation

@bradystroud

Copy link
Copy Markdown
Member

Problem

EasyLeave deducts the employee's lunch break from every leave day. A 09:00-13:00 half day therefore counts 3 hours, not 4. The API accepts TimeLessOverride to replace that deduction, but no CLI or MCP surface could set it, so the only fix was the web UI.

Change

  • tp leave create and tp leave update take --less <MINUTES>. --less 0 means no break.
  • tp leave update also takes --clear-less to go back to the lunch-break default.
  • MCP CreateLeave / UpdateLeave take lessMinutes, and UpdateLeave takes clearLess.
  • The value is in minutes, the same as tp ts create --less. The services convert it to hours. In the backend, TimeLessOverride is in hours (LeaveEntry subtracts TimeSpan.FromHours). 0 means no break, and null means the lunch-break deduction. The leave timesheets take their less from it too (TimesheetsDto.FromLeave).

Bug fix found on the way

Before this change, an update to a partial-day request without --start-time / --end-time changed its window to the profile workday. The list response does not return UserStartTime / UserEndTime, so LeaveUpdateService used the profile hours and calculated the partial-day start and end from them. A dry run of --less 0 on a real 09:00-13:00 request showed 08:00-17:00. Now, when a request stays partial-day, the update keeps the window from the request's own start and end.

Verification

  • New unit tests: --less 0 / 30 / 60 converts to hours, --clear-less sends null, invalid values and --less together with --clear-less are rejected, create with and without --less, and a partial-day request with no stored workday times keeps 09:00-13:00.
  • dotnet test: 611 unit and 305 integration tests pass. The MCP discovery goldens were regenerated for the new parameters.
  • A dry run against production with the local build showed the correct payload: 09:00-13:00, timeLessOverride: 0.

Docs: AGENTS.md (units and meaning of TimeLessOverride), the README and the timesheet skill template. I did not write release notes, because they are written at release time.

Small, low-risk change, so it did not need a plan review.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rf633EiNySafrMCHZnMM7W

…s window on update

EasyLeave deducts the employee's lunch break from every leave day, so a
09:00-13:00 half day counts 3 hours. The API takes TimeLessOverride (hours)
to replace that deduction, but no CLI or MCP surface could set it.

- tp leave create and tp leave update take --less <MINUTES>; update also
  takes --clear-less to go back to the lunch-break default
- MCP CreateLeave and UpdateLeave take lessMinutes; UpdateLeave takes clearLess
- Updating a partial-day request no longer widens it to the profile workday.
  The list response omits UserStartTime/UserEndTime, so the window now comes
  from the request's own start and end

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rf633EiNySafrMCHZnMM7W
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