Skip to content

Commit

Permalink
Merge pull request #182 from ActivityWatch/dev/demomode-active-history
Browse files Browse the repository at this point in the history
feat: added active history data to demomode, removed excessive logging
  • Loading branch information
ErikBjare committed Apr 16, 2020
2 parents 91bdb2c + 107ae4d commit fbcb5ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 20 additions & 2 deletions src/store/modules/activity_daily.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ const actions = {
const periods = timeperiodStrsAroundTimeperiod(timeperiod).filter(tp_str => {
return !_.includes(state.active_history, tp_str);
});
console.log(periods);
const bucket_id_afk = 'aw-watcher-afk_' + host;
const queryStart = moment();
const data = await this._vm.$aw.query(periods, queries.dailyActivityQuery(bucket_id_afk));
Expand Down Expand Up @@ -330,6 +329,24 @@ const actions = {
languages: [{ duration: 10, data: { language: 'python' } }],
projects: [{ duration: 10, data: { project: 'aw-core' } }],
});

function build_active_history() {
const active_history = {};
let current_day = moment(get_day_start_with_offset());
_.map(_.range(0, 30), () => {
const current_day_end = moment(current_day).add(1, 'day');
active_history[`${current_day.format()}/${current_day_end.format()}`] = [
{
timestamp: current_day.format(),
duration: 100 + 900 * Math.random(),
data: { status: 'not-afk' },
},
];
current_day = current_day.add(-1, 'day');
});
return active_history;
}
commit('query_active_history_completed', { active_history: build_active_history() });
},
};

Expand All @@ -355,6 +372,8 @@ const mutations = {
state.top_categories = null;
state.active_duration = null;
state.active_events = null;

state.active_history = {};
},

query_window_completed(state, data) {
Expand All @@ -364,7 +383,6 @@ const mutations = {
state.active_duration = data['duration'];
state.app_chunks = data['app_chunks'];
state.active_events = data['active_events'];
console.log(state.active_events);
},

query_browser_completed(state, data) {
Expand Down
2 changes: 0 additions & 2 deletions src/views/activity/daily/ActivityDaily.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export default {
},
categories: function() {
const cats = this.$store.getters['settings/all_categories'];
console.log(cats);
const entries = cats.map(c => {
return { text: c.join(' > '), value: c };
});
Expand All @@ -149,7 +148,6 @@ export default {
const cats = this.$store.getters['settings/all_categories'];
const isChild = p => c => c.length > p.length && _.isEqual(p, c.slice(0, p.length));
const children = _.filter(cats, isChild(this.filterCategory));
console.log(children);
return [this.filterCategory].concat(children);
} else {
return null;
Expand Down

0 comments on commit fbcb5ab

Please sign in to comment.