Skip to content

Commit 2acb3cb

Browse files
committed
fix: reintroduced active events for barchart visualization
1 parent 554d05a commit 2acb3cb

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/queries.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,12 @@ export function fullDesktopQuery(
165165
${canonicalEvents(params)}
166166
events = categorize(events, ${classes_str});
167167
` +
168-
(filterCategories
169-
? `events = filter_keyvals(events, "$category", ${JSON.stringify(filterCategories)});`
170-
: '') +
171-
`
168+
(filterCategories
169+
? `events = filter_keyvals(events, "$category", ${JSON.stringify(filterCategories)});`
170+
: '') +
171+
`
172172
title_events = sort_by_duration(merge_events_by_keys(events, ["app", "title"]));
173173
app_events = sort_by_duration(merge_events_by_keys(title_events, ["app"]));
174-
cat_events = [];
175174
cat_events = sort_by_duration(merge_events_by_keys(events, ["$category"]));
176175
177176
app_events = limit_events(app_events, ${default_limit});
@@ -193,6 +192,7 @@ export function fullDesktopQuery(
193192
"app_events": app_events,
194193
"title_events": title_events,
195194
"cat_events": cat_events,
195+
"active_events": not_afk,
196196
"duration": duration
197197
},
198198
"browser": {

src/store/modules/activity.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ const _state = {
6363
active: {
6464
available: false,
6565
duration: 0,
66+
// non-afk events (no detail data) for the current period
67+
events: [],
68+
// Aggregated events for current and past periods
6669
history: {},
6770
},
6871

@@ -178,15 +181,16 @@ const actions = {
178181
app_events: [],
179182
title_events: [],
180183
cat_events: [],
184+
active_events: [],
181185
duration: 0,
182186
};
183187
commit('query_window_completed', data);
184188
},
185189

186190
async query_desktop_full(
187191
{ state, commit },
188-
{ timeperiod, filterCategories, filterAFK }: QueryOptions)
189-
{
192+
{ timeperiod, filterCategories, filterAFK }: QueryOptions
193+
) {
190194
const periods = [timeperiodToStr(timeperiod)];
191195
const classes = loadClassesForQuery();
192196
const q = queries.fullDesktopQuery(
@@ -411,6 +415,9 @@ const actions = {
411415
app_events,
412416
title_events,
413417
cat_events,
418+
active_events: [
419+
{ timestamp: new Date().toISOString(), duration: 1.5 * 60 * 60, data: { afk: 'not-afk' } },
420+
],
414421
});
415422

416423
commit('browser_buckets', ['aw-watcher-firefox']);
@@ -493,6 +500,7 @@ const mutations = {
493500
state.window.top_titles = data['title_events'];
494501
state.category.top = data['cat_events'];
495502
state.active.duration = data['duration'];
503+
state.active.events = data['active_events'];
496504
},
497505

498506
query_browser_completed(state, data) {

0 commit comments

Comments
 (0)