feat(views): add WorkReport view with fixed date range handling#774
feat(views): add WorkReport view with fixed date range handling#774TimeToBuildBob wants to merge 1 commit intoActivityWatch:masterfrom
Conversation
Fixes two bugs from the initial implementation in ActivityWatch#742: - Fix startOfDay offset parsing: the settings value is "HH:MM" string but was passed raw to moment().add(), which expects a number+unit. Now parsed as [hours, minutes] and added separately. - Implement all date range options: thisWeek, thisMonth, and custom were advertised in the UI but not implemented in getTimeperiods(). All five options now work correctly. Also adds date picker inputs for the custom range, with sensible defaults (last 7 days). Co-Authored-By: Bob <timetobuildbob@gmail.com>
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 6745a6b in 12 seconds. Click for details.
- Reviewed
425lines of code in3files - Skipped
0files when reviewing. - Skipped posting
0draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
Workflow ID: wflow_7CvNIBV2HwVdEq3V
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #774 +/- ##
==========================================
- Coverage 25.71% 25.69% -0.02%
==========================================
Files 30 30
Lines 1750 1751 +1
Branches 307 320 +13
==========================================
Hits 450 450
- Misses 1278 1279 +1
Partials 22 22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Greptile SummaryThis PR successfully adds a Work Report view that allows users to track work time across multiple devices with flexible date range filtering and export capabilities. The implementation fixes two critical bugs from the previous attempt: Fixes Applied:
Key Features:
Minor Issue:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User Opens Work Report] --> B[Load Stores: Categories, Buckets, Settings]
B --> C[Auto-select All Available Hosts]
C --> D[User Configures Filters]
D --> E{User Clicks Calculate}
E --> F[Validate Inputs]
F --> G{Hosts Selected?}
G -->|No| H[Show Error: Select Host]
G -->|Yes| I[Get Timeperiods with startOfDay Offset]
I --> J{Valid Date Range?}
J -->|No| K[Show Error: Invalid Range]
J -->|Yes| L[Build Query for Each Host]
L --> M[Query: flood → categorize → filter_keyvals]
M --> N[Combine Events with union_no_overlap]
N --> O[Execute Query for Each Day]
O --> P[Process Results into Daily Data]
P --> Q[Display Daily Breakdown Table]
Q --> R{User Action}
R -->|Export CSV| S[Generate CSV File]
R -->|Export JSON| T[Generate JSON File]
R -->|Recalculate| E
S --> U[Download File]
T --> U
Last reviewed commit: 6745a6b |
| const offsetStr = this.settingsStore.startOfDay as string; | ||
| const [offsetHours, offsetMinutes] = offsetStr.split(':').map(Number); |
There was a problem hiding this comment.
Add null check before parsing startOfDay. If the setting is undefined, this will crash. Consider using the existing utility functions like get_day_start_with_offset() from ~/util/time or add a fallback:
| const offsetStr = this.settingsStore.startOfDay as string; | |
| const [offsetHours, offsetMinutes] = offsetStr.split(':').map(Number); | |
| const offsetStr = (this.settingsStore.startOfDay as string) || '04:00'; | |
| const [offsetHours, offsetMinutes] = offsetStr.split(':').map(Number); |
There was a problem hiding this comment.
Probably use get_day_start_with_offset
Continuation of #742 (taking over as requested by @ErikBjare).
Adds the Work Report view with two critical bugs fixed:
Fixes
1.
startOfDayoffset parsing bug (fixes Greptile finding)The
startOfDaysetting returns a string like"04:00"but was passed directly tomoment().add(offset), which expects a number+unit pair. This caused a runtime error when calculating timeperiods.Fix: Parse the
"HH:MM"string into hours and minutes, then apply separately:2. Missing date range implementations (fixes Greptile finding)
thisWeek,thisMonth, andcustomwere shown in the dropdown but fell through to an empty array ingetTimeperiods().Fix: All five date ranges are now implemented. The
customoption also gets proper date picker inputs (with defaults of last 7 days).Changes
src/views/WorkReport.vue— new view (fixes from feat: added workreport view #742)src/components/Header.vue— adds "Work Report" to Tools dropdownsrc/route.js— adds/work-reportrouteCloses #742 (supersedes it with bug fixes applied).
Important
Adds
WorkReport.vuewith fixed date range handling, integrates it into the app, and fixes critical bugs.WorkReport.vuefor work time reporting with fixed date range handling.startOfDayoffset parsing bug by parsing "HH:MM" into hours and minutes.thisWeek,thisMonth, andcustomingetTimeperiods().Header.vue./work-reportroute inroute.js.This description was created by
for 6745a6b. You can customize this summary. It will automatically update as commits are pushed.