mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-31 03:30:50 +00:00
* fix(tasks): make the parent task time pair add up (#9190) A parent task renders "Σ time spent / ⏳ time left". Both cells are rounded down for display, so the partial minute they share was dropped twice and the pair read a minute short of the work it represents: 2m and 1m sub tasks with a few seconds tracked showed 2m. Derive the left cell from the floored pair, so what is on screen adds up to the rounded down real total for every input. Rounding the left cell up would fix the reported case too, but reads a minute long once a sub task is done or over its estimate, because a done sub task's unspent estimate is dropped and an over-run is clamped to 0 while the spent sum counts both. Sum the time left from the sub tasks instead of reading the parent's stored timeEstimate, which holds the same sum but is only refreshed on estimate edits, done toggles and structural changes - a tracking tick updates the parent's time spent alone. Reading it would leave the time left standing still while time is tracked, and make the pair jump by a minute as the time spent crosses one. The spec pins the sum against the reducer's own output. Only the task row is affected; the planner and the Today header render the same value without a paired time spent, so they keep their own rounding. * refactor(tasks): trim the parent time pair helper (#9190) Cut the doc comment down to the two constraints that are not obvious from the code - that the two values stop being complementary once a sub task is done or over its estimate, and that the stored timeEstimate is not refreshed by a tracking tick - and drop the sweep from the spec, which the derived rule makes redundant: the identity holds by construction, so it could only fail on a formatting break the explicit cases already cover. Verified the spec still discriminates: reverting to the raw value fails 4, rounding up fails 4 different ones, the real implementation passes 8. * test(tasks): cover the parent time pair in the browser (#9190) Nothing rendered this row: both TaskComponent harnesses blank the template via overrideComponent, and templates are only type-checked under AOT, so the computed -> binding -> pipe -> DOM chain had no test behind it. Short syntax sets time spent and estimate directly ('0.05m/2m' is 3s against a 2m estimate), so the reported state is reproducible without tracking for real. Reverting the helper to the pre-fix rounding renders 'functions -/hourglass_empty 2m' and fails this test. * fix(tasks): narrow the time-left borrow and share the sum (#9190) A second review round turned up three problems in the previous commits. The borrowed partial minute made the cell oscillate. Deriving the time left from the floored pair is only sound while the two cells are two halves of one total; once a sub task is done or over its estimate the spent sum keeps counting it while the time left does not, so the borrow flipped the cell up and down twice per tracked minute - the same defect that ruled out reading the stored timeEstimate. Restrict it to the complementary case, where it fixes the reported bug, and fall back to the plain floored remainder otherwise, which is what that state always displayed. The time-left sum was duplicated from reCalcTimeEstimateForParentIfParent. Open PR #8038 rewrites that formula for nested sub tasks and the copy would have diverged silently, since the two files do not touch. Extract it so both call one function; the reducer specs that already pin the sum now pin the display with it. The isDone term had no test that could fail: every done fixture was also at or over its estimate, so max(0, ...) already yielded 0. The over-run clamp had the same hole, exceeded by only 40s and absorbed by the floor. Fold the e2e into the existing sub task spec, with a fixture whose tracked time is actually rendered ('1.05m/2m'), so short syntax drifting can no longer turn it into a vacuous pass. Gate the row on the value it renders. |
||
|---|---|---|
| .. | ||
| add-subtask-with-detail-panel-open.spec.ts | ||
| drag-task-into-subtask.spec.ts | ||
| finish-day-quick-history-with-subtasks.spec.ts | ||
| finish-day-quick-history.spec.ts | ||
| simple-subtask.spec.ts | ||
| task-list-start-stop.spec.ts | ||