Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web: non-afk time is not being properly tallyed up #687

Closed
2 tasks done
kewde opened this issue Nov 10, 2021 · 4 comments
Closed
2 tasks done

web: non-afk time is not being properly tallyed up #687

kewde opened this issue Nov 10, 2021 · 4 comments

Comments

@kewde
Copy link
Contributor

kewde commented Nov 10, 2021

  • I am on the latest ActivityWatch version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • OS name and version: Windows 10
  • ActivityWatch version: v0.11.0

Describe the bug

The timeline barchart + time active of the activity view is under-reporting the actual hours.
activitywatchbug
activitywatchbughalffix

To Reproduce

Count up non-afk time for a day, compare it with what's shown in the "Activity view" under "time active".

Expected behavior

All Non-AFK time being properly tallyed

@github-actions
Copy link

Hi there!
As you're new to this repo, please make sure you've used an appropriate issue template and searched for duplicates (it helps us focus on actual development!). We'd also like to suggest that you read our contribution guidelines and our code of conduct.
Thanks a bunch for opening your first issue! 🙏

@kewde
Copy link
Contributor Author

kewde commented Nov 10, 2021

I noticed that the returned output of the HTTP request for /query doesn't include any events for the hour 4 PM.
Either the query is broken or the query engine behind it is malfunctioning.

The 13th element (index 12) represents the 4PM column because Activity Watch starts counting from 4 AM. As you can see in the screenshot, it's empty.
activitywatchbugquery

{
    "query": [
        "\n    events = flood(query_bucket(\"aw-watcher-window_DESKTOP-T3POCHP\"));",
        "\n\nnot_afk = flood(query_bucket(\"aw-watcher-afk_DESKTOP-T3POCHP\"));",
        "\n         not_afk = filter_keyvals(not_afk, \"status\", [\"not-afk\"]);",
        "\n\n    browser_events = [];",
        "\n  \nevents = filter_period_intersect(events, not_afk);",
        "\nevents = categorize(events, [[[\"Work\"],{\"type\":\"regex\",\"regex\":\"Google Docs|libreoffice|ReText\"}],[[\"Work\",\"Programming\"],{\"type\":\"regex\",\"regex\":\"GitHub|Stack Overflow|BitBucket|Gitlab|vim|Spyder|kate|Ghidra|Scite|VirtualBoxVM\"}],[[\"Work\",\"Programming\",\"ActivityWatch\"],{\"type\":\"regex\",\"regex\":\"ActivityWatch|aw-\",\"ignore_case\":true}],[[\"Work\",\"Image\"],{\"type\":\"regex\",\"regex\":\"Gimp|Inkscape\"}],[[\"Work\",\"Video\"],{\"type\":\"regex\",\"regex\":\"Kdenlive\"}],[[\"Work\",\"Audio\"],{\"type\":\"regex\",\"regex\":\"Audacity\"}],[[\"Work\",\"3D\"],{\"type\":\"regex\",\"regex\":\"Blender\"}],[[\"Media\",\"Games\"],{\"type\":\"regex\",\"regex\":\"Minecraft|RimWorld\"}],[[\"Media\",\"Video\"],{\"type\":\"regex\",\"regex\":\"YouTube|Plex|VLC\"}],[[\"Media\",\"Social Media\"],{\"type\":\"regex\",\"regex\":\"reddit|Facebook|Twitter|Instagram|devRant\",\"ignore_case\":true}],[[\"Media\",\"Music\"],{\"type\":\"regex\",\"regex\":\"Spotify|Deezer\",\"ignore_case\":true}],[[\"Comms\",\"IM\"],{\"type\":\"regex\",\"regex\":\"Messenger|Telegram|Signal|WhatsApp|Rambox|Slack|Riot|Discord|Nheko\",\"ignore_case\":true}],[[\"Comms\",\"Email\"],{\"type\":\"regex\",\"regex\":\"Gmail|Thunderbird|mutt|alpine\"}],[[\"Work\",\"Research\"],{\"type\":\"regex\",\"regex\":\"msedge|chrome\"}]]);",
        "\n\n    cat_events   = sort_by_duration(merge_events_by_keys(events, [\"$category\"]));",
        "\n    RETURN = { \"cat_events\": cat_events };",
        "\n  ;"
    ],
    "timeperiods": [
        "2021-11-10T04:00:00+01:00/2021-11-10T05:00:00+01:00",
        "2021-11-10T05:00:00+01:00/2021-11-10T06:00:00+01:00",
        "2021-11-10T06:00:00+01:00/2021-11-10T07:00:00+01:00",
        "2021-11-10T07:00:00+01:00/2021-11-10T08:00:00+01:00",
        "2021-11-10T08:00:00+01:00/2021-11-10T09:00:00+01:00",
        "2021-11-10T09:00:00+01:00/2021-11-10T10:00:00+01:00",
        "2021-11-10T10:00:00+01:00/2021-11-10T11:00:00+01:00",
        "2021-11-10T11:00:00+01:00/2021-11-10T12:00:00+01:00",
        "2021-11-10T12:00:00+01:00/2021-11-10T13:00:00+01:00",
        "2021-11-10T13:00:00+01:00/2021-11-10T14:00:00+01:00",
        "2021-11-10T14:00:00+01:00/2021-11-10T15:00:00+01:00",
        "2021-11-10T15:00:00+01:00/2021-11-10T16:00:00+01:00",
        "2021-11-10T16:00:00+01:00/2021-11-10T17:00:00+01:00",
        "2021-11-10T17:00:00+01:00/2021-11-10T18:00:00+01:00",
        "2021-11-10T18:00:00+01:00/2021-11-10T19:00:00+01:00",
        "2021-11-10T19:00:00+01:00/2021-11-10T20:00:00+01:00",
        "2021-11-10T20:00:00+01:00/2021-11-10T21:00:00+01:00",
        "2021-11-10T21:00:00+01:00/2021-11-10T22:00:00+01:00",
        "2021-11-10T22:00:00+01:00/2021-11-10T23:00:00+01:00",
        "2021-11-10T23:00:00+01:00/2021-11-11T00:00:00+01:00",
        "2021-11-11T00:00:00+01:00/2021-11-11T01:00:00+01:00",
        "2021-11-11T01:00:00+01:00/2021-11-11T02:00:00+01:00",
        "2021-11-11T02:00:00+01:00/2021-11-11T03:00:00+01:00",
        "2021-11-11T03:00:00+01:00/2021-11-11T04:00:00+01:00"
    ]
}

@ErikBjare
Copy link
Member

ErikBjare commented Nov 10, 2021

Looks like a duplicate of #609, which is fixed in master (and available in nightly releases, see #507).

Not sure about the non-afk time not adding up though (might be related to the above issue, but not sure). If you could try a nightly build and report back that would be helpful!

Edit: the non-afk time not adding up may be fixed by ActivityWatch/aw-core#105

@kewde
Copy link
Contributor Author

kewde commented Nov 10, 2021

@ErikBjare
The barchart has been fixed by switching over to Rust.

When I tallyed up the times again and my initial calculation was wrong. I'm still getting a few minutes of difference between what's show in 'Time Active' and manually adding up the non-afk events in the timeline but it's in the order of minutes, which is acceptable to me.

I'll give the nightlies a go on my personal machine, thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants