feat(projects): expose per-task logged_hours (non-rejected) alongside approved actual_hours #249
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-329-task-logged-hours"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
A task's
actual_hoursrollup counts onlyapproval_status = 'approved'time entries, so time logged against a task is invisible (0h) until it is submitted and approved. MAPPS-167 wants the task to show both numbers: total logged (everything not rejected) and approved. A client cannot compute the logged total itself because/time-entriesis self-scoped and would miss other users' time on a shared task, so the rollup must come from the server.Changes
logged_hours: Option<Decimal>toTaskResponseandlogged_hoursto the internalTaskRow+Fromimpl.list_project_tasksandget_task), add a sibling subquery that sums non-rejected (approval_status <> 'rejected', i.e. draft + pending + approved) time-entry durations bytask_id, divided to hours.actual_hoursis unchanged (approved-only).logged_hours >= actual_hoursalways.logged_hourscould follow later if wanted).Tests
task_logged_hours_counts_non_rejected(intests/projects.rs), green against a throwaway Postgres. It drives the approval transitions directly in SQL so it pins the rollup SELECT rather than the timesheet state machine:logged_hours = 2.0,actual_hours = 0.0= 2.0= 0.0GET /projects/{id}/tasks) also carrieslogged_hoursThe existing
approved_time_rolls_into_actualsregression still passes (actual_hours behavior unchanged). Fullprojectssuite: 12/12.#PMS-329