feat: add work time report view#775
feat: add work time report view#775TimeToBuildBob wants to merge 1 commit intoActivityWatch:masterfrom
Conversation
Add a new Work Report view that provides daily work time breakdowns with multi-device support, category filtering, configurable break time (gap merging via flood), and CSV/JSON export. Based on ActivityWatch#742 by @ErikBjare. Changes from original: - Implemented thisWeek and thisMonth date ranges - Removed debug console.log statements - Used safeHost consistently in find_bucket queries Closes ActivityWatch#742
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 88123f9 in 14 seconds. Click for details.
- Reviewed
373lines 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_dYhmm0zRl5puWjmN
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 #775 +/- ##
==========================================
- Coverage 25.71% 25.69% -0.02%
==========================================
Files 30 30
Lines 1750 1751 +1
Branches 307 307
==========================================
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 adds a comprehensive Work Time Report feature that provides daily work time breakdowns across multiple devices with configurable break times and category filtering. The implementation includes CSV/JSON export capabilities and supports various date ranges (last 7/30 days, this week, this month). Major Changes:
Critical Issue Found:
Code Quality:
Confidence Score: 2/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User Selects Hosts & Categories] --> B[Click Calculate Work Time]
B --> C[Get Time Periods Based on Date Range]
C --> D{For Each Host}
D --> E[Query aw-watcher-window Bucket]
E --> F[Apply flood to Merge Gaps < Break Time]
F --> G[Categorize Events]
G --> H[Filter by Selected Categories]
H --> I[Store as events_hostname]
I --> D
D --> J[Combine All Host Events via union_no_overlap]
J --> K[Calculate Duration & Session Count]
K --> L[Map to Daily Breakdown]
L --> M[Display Table with Totals]
M --> N{User Action}
N -->|Export CSV| O[Generate CSV File]
N -->|Export JSON| P[Generate JSON File]
N -->|Done| Q[End]
O --> Q
P --> Q
Last reviewed commit: 88123f9 |
| for (const hostname of this.selectedHosts) { | ||
| const safeHost = hostname.replace(/[^a-zA-Z0-9_]/g, ''); | ||
| query += ` | ||
| events_${safeHost} = flood(query_bucket(find_bucket("aw-watcher-window_${safeHost}")), ${breakTimeSeconds}); |
There was a problem hiding this comment.
safeHost used in find_bucket() won't match actual bucket IDs when hostnames contain special characters (e.g., "my-laptop" becomes "mylaptop"). Use original hostname variable instead.
| events_${safeHost} = flood(query_bucket(find_bucket("aw-watcher-window_${safeHost}")), ${breakTimeSeconds}); | |
| events_${safeHost} = flood(query_bucket(find_bucket("aw-watcher-window_${hostname}")), ${breakTimeSeconds}); |
|
Duplicate of #774, decide which to keep and which to close. Figure out if any differences should be transferred. |
Summary
Changes from #742
thisWeekandthisMonthdate ranges (were TODO)console.logstatementssafeHostconsistently infind_bucketqueries (Ellipsis review suggestion)How it works
The view queries
aw-watcher-windowbuckets per host, appliesflood()to merge gaps shorter than the configured break time, categorizes events, filters by selected categories, and combines results across devices usingunion_no_overlap. Results are displayed as a daily breakdown table with totals.Test plan
Closes #742
Important
Adds a Work Report view with detailed work time breakdowns, multi-device support, and export options, accessible from the Tools dropdown.
WorkReport.vuefor a detailed work time report view with daily breakdowns, multi-device support, category filtering, configurable break time, and CSV/JSON export.Header.vue./work-reportinroute.js.thisWeekandthisMonthdate ranges.console.logstatements.safeHostin queries.This description was created by
for 88123f9. You can customize this summary. It will automatically update as commits are pushed.