feat: implement client targets v2 (weekly/monthly periods, working days, pro-ration) #8

Merged
simonfranken merged 2 commits from client-targets-v2 into main 2026-02-24 20:29:24 +00:00
Owner
  • Add PeriodType enum and working_days column to ClientTarget schema
  • Rename weekly_hours -> target_hours; remove Monday-only constraint
  • Add migration 20260224000000_client_targets_v2
  • Rewrite computeBalance() to support weekly/monthly periods, per-spec
    pro-ration for first period, ongoing vs completed period logic, and
    elapsed working-day counting (§4–§6 of requirements doc)
  • Update Zod schemas and TypeScript input types for new fields
  • Frontend: replace WeekBalance with PeriodBalance; update
    ClientTargetWithBalance to currentPeriod* fields
  • ClientTargetPanel: period type radio, working-day toggles, free date
    picker, dynamic hours label
  • DashboardPage: rename widget to Targets, dynamic This week/This month
    label
- Add PeriodType enum and working_days column to ClientTarget schema - Rename weekly_hours -> target_hours; remove Monday-only constraint - Add migration 20260224000000_client_targets_v2 - Rewrite computeBalance() to support weekly/monthly periods, per-spec pro-ration for first period, ongoing vs completed period logic, and elapsed working-day counting (§4–§6 of requirements doc) - Update Zod schemas and TypeScript input types for new fields - Frontend: replace WeekBalance with PeriodBalance; update ClientTargetWithBalance to currentPeriod* fields - ClientTargetPanel: period type radio, working-day toggles, free date picker, dynamic hours label - DashboardPage: rename widget to Targets, dynamic This week/This month label
simonfranken added 1 commit 2026-02-24 18:02:55 +00:00
- Add PeriodType enum and working_days column to ClientTarget schema
- Rename weekly_hours -> target_hours; remove Monday-only constraint
- Add migration 20260224000000_client_targets_v2
- Rewrite computeBalance() to support weekly/monthly periods, per-spec
  pro-ration for first period, ongoing vs completed period logic, and
  elapsed working-day counting (§4–§6 of requirements doc)
- Update Zod schemas and TypeScript input types for new fields
- Frontend: replace WeekBalance with PeriodBalance; update
  ClientTargetWithBalance to currentPeriod* fields
- ClientTargetPanel: period type radio, working-day toggles, free date
  picker, dynamic hours label
- DashboardPage: rename widget to Targets, dynamic This week/This month
  label
simonfranken added 1 commit 2026-02-24 20:27:08 +00:00
A correction dated in the future (within the current period) was being
added to the balance immediately, while the corresponding expected hours
were not yet counted (elapsed working days only go up to today).

Fix: in the ongoing-period branch, sum only corrections whose date is
<= today, matching the same window used for elapsed working days and
tracked time.
simonfranken merged commit b7bd875462 into main 2026-02-24 20:29:24 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: simonfranken/timetracker#8