Skip to content

Commit f9fa6d2

Browse files
committed
feat: maybe done with audible-as-active
1 parent 13a927f commit f9fa6d2

4 files changed

Lines changed: 26 additions & 10 deletions

File tree

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@typescript-eslint/explicit-function-return-type": ["off"],
2020
"@typescript-eslint/no-var-requires": ["off"],
2121
"@typescript-eslint/no-explicit-any": ["off"],
22-
"@typescript-eslint/no-use-before-define": "warn",
22+
"@typescript-eslint/no-use-before-define": ["error", {"functions": false, "classes": false}],
2323
"@typescript-eslint/no-unused-vars": ["warn", {"argsIgnorePattern": "^_"}],
2424
"@typescript-eslint/no-this-alias": [
2525
"warn",

src/queries.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ export function canonicalEvents(params: DesktopQueryParams | AndroidQueryParams)
6969
: '',
7070
// Fetch browser events
7171
params.bid_browsers
72-
? browserEvents(params) +
73-
// Include focused and audible browser events as indications of not-afk
74-
(params.include_audible
75-
? `audible_events = filter_keyvals(browser_events, "audible", [true]);
72+
? isDesktopParams(params) &&
73+
browserEvents(params) +
74+
// Include focused and audible browser events as indications of not-afk
75+
(params.include_audible
76+
? `audible_events = filter_keyvals(browser_events, "audible", [true]);
7677
not_afk = period_union(not_afk, audible_events);`
77-
: '')
78+
: '')
7879
: '',
7980
// Filter out window events when the user was afk
8081
isDesktopParams(params) && params.filter_afk
@@ -190,7 +191,8 @@ export function fullDesktopQuery(
190191
afkbucket: string,
191192
filterAFK = true,
192193
classes,
193-
filterCategories: string[][]
194+
filterCategories: string[][],
195+
include_audible: boolean
194196
): string[] {
195197
// Escape `"`
196198
browserbuckets = _.map(browserbuckets, escape_doublequote);
@@ -205,6 +207,7 @@ export function fullDesktopQuery(
205207
classes: classes,
206208
filter_classes: filterCategories,
207209
filter_afk: filterAFK,
210+
include_audible,
208211
};
209212

210213
return querystr_to_array(

src/store/modules/activity.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface QueryOptions {
3131
date?: string;
3232
timeperiod?: TimePeriod;
3333
filterAFK?: boolean;
34+
includeAudible?: boolean;
3435
filterCategories?: string[][];
3536
force?: boolean;
3637
}
@@ -215,7 +216,7 @@ const actions = {
215216

216217
async query_desktop_full(
217218
{ state, commit, rootState, rootGetters },
218-
{ timeperiod, filterCategories, filterAFK }: QueryOptions
219+
{ timeperiod, filterCategories, filterAFK, includeAudible }: QueryOptions
219220
) {
220221
const periods = [timeperiodToStr(timeperiod)];
221222
const classes = loadClassesForQuery();
@@ -225,7 +226,8 @@ const actions = {
225226
state.buckets.afk[0],
226227
filterAFK,
227228
classes,
228-
filterCategories
229+
filterCategories,
230+
includeAudible
229231
);
230232
const data = await this._vm.$aw.query(periods, q);
231233

src/views/activity/Activity.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ div
6767
b-form-group(label="Show/filter category" label-cols="5" label-cols-lg="4")
6868
b-form-select(v-model="filterCategory", :options="categories")
6969

70+
div.row
71+
div.col-md-12
72+
b-form-group(label="Filter AFK" label-cols="11")
73+
b-form-checkbox(v-model="filterAFK")
74+
div.col-md-12
75+
b-form-group(label="Browser audible as active" label-cols="11")
76+
b-form-checkbox(v-model="includeAudible")
77+
7078
aw-devonly
7179
b-btn(id="load-demo", @click="load_demo")
7280
| Load demo data
@@ -143,6 +151,8 @@ export default {
143151
return {
144152
today: get_today(),
145153
filterCategory: null,
154+
includeAudible: true,
155+
filterAFK: true,
146156
new_view: {},
147157
};
148158
},
@@ -262,7 +272,8 @@ export default {
262272
timeperiod: this.timeperiod,
263273
host: this.host,
264274
force: force,
265-
filterAFK: true,
275+
filterAFK: this.filterAFK,
276+
includeAudible: this.includeAudible,
266277
filterCategories: this.filterCategories,
267278
});
268279
},

0 commit comments

Comments
 (0)