ActivityWatch / aw-webui

Webapp for visualizing and browsing ActivityWatch data, built with Vue.js.
Mozilla Public License 2.0
101 stars 100 forks source link

Unnecessary call to `find_bucket` at activity page #590

Open Rubikoid opened 1 month ago

Rubikoid commented 1 month ago

Query builder for activity page builds query like:

events = flood(query_bucket(find_bucket("aw-watcher-window_rubi-mbp14")));
not_afk = flood(query_bucket(find_bucket("aw-watcher-afk_rubi-mbp14")));

Where find_bucket is unnecessary because there are already full name of bucket, which can be passed to query_bucket.

In the same time, it find_bucket usage leads to problems when bucket for hostname with some suffix also exists, like in https://github.com/ActivityWatch/activitywatch/issues/998#issuecomment-2166226248

brayo-pip commented 4 weeks ago

I think find_bucket is still necessary. On my laptop it doesn't seem to have the hostname and the query looks like this

afk_events = query_bucket(find_bucket("aw-watcher-afk_"));
window_events = query_bucket(find_bucket("aw-watcher-window_"));

I do not know how to fix the suffix issue yet. I will try looking into it.