Skip to content

Commit

Permalink
fix: reintroduced active events for barchart visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Jun 10, 2020
1 parent 554d05a commit 2acb3cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/queries.ts
Expand Up @@ -165,13 +165,12 @@ export function fullDesktopQuery(
${canonicalEvents(params)}
events = categorize(events, ${classes_str});
` +
(filterCategories
? `events = filter_keyvals(events, "$category", ${JSON.stringify(filterCategories)});`
: '') +
`
(filterCategories
? `events = filter_keyvals(events, "$category", ${JSON.stringify(filterCategories)});`
: '') +
`
title_events = sort_by_duration(merge_events_by_keys(events, ["app", "title"]));
app_events = sort_by_duration(merge_events_by_keys(title_events, ["app"]));
cat_events = [];
cat_events = sort_by_duration(merge_events_by_keys(events, ["$category"]));
app_events = limit_events(app_events, ${default_limit});
Expand All @@ -193,6 +192,7 @@ export function fullDesktopQuery(
"app_events": app_events,
"title_events": title_events,
"cat_events": cat_events,
"active_events": not_afk,
"duration": duration
},
"browser": {
Expand Down
12 changes: 10 additions & 2 deletions src/store/modules/activity.ts
Expand Up @@ -63,6 +63,9 @@ const _state = {
active: {
available: false,
duration: 0,
// non-afk events (no detail data) for the current period
events: [],
// Aggregated events for current and past periods
history: {},
},

Expand Down Expand Up @@ -178,15 +181,16 @@ const actions = {
app_events: [],
title_events: [],
cat_events: [],
active_events: [],
duration: 0,
};
commit('query_window_completed', data);
},

async query_desktop_full(
{ state, commit },
{ timeperiod, filterCategories, filterAFK }: QueryOptions)
{
{ timeperiod, filterCategories, filterAFK }: QueryOptions
) {
const periods = [timeperiodToStr(timeperiod)];
const classes = loadClassesForQuery();
const q = queries.fullDesktopQuery(
Expand Down Expand Up @@ -411,6 +415,9 @@ const actions = {
app_events,
title_events,
cat_events,
active_events: [
{ timestamp: new Date().toISOString(), duration: 1.5 * 60 * 60, data: { afk: 'not-afk' } },
],
});

commit('browser_buckets', ['aw-watcher-firefox']);
Expand Down Expand Up @@ -493,6 +500,7 @@ const mutations = {
state.window.top_titles = data['title_events'];
state.category.top = data['cat_events'];
state.active.duration = data['duration'];
state.active.events = data['active_events'];
},

query_browser_completed(state, data) {
Expand Down

0 comments on commit 2acb3cb

Please sign in to comment.