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

Creation of a category with Rule of Type: None throws an exception #313

Closed
muhdiboy opened this issue Nov 18, 2019 · 2 comments
Closed

Creation of a category with Rule of Type: None throws an exception #313

muhdiboy opened this issue Nov 18, 2019 · 2 comments

Comments

@muhdiboy
Copy link

Describe the bug

The newly introduced category feature in version 0.8.1 has a bug when creating a new category with no Rules (Type: None).

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Settings'
  2. Click on 'Add category'
  3. Edit category (click on edit icon on the right hand side)
  4. Set 'Type' of 'Rule' in Menu to 'None' and click 'OK'
  5. Save
  6. Go to 'Activity' and you will see a red banner with following text: "Error: Request failed with status code 400. See dev console (F12) and/or server logs for more info."

Expected behavior

The pregiven categories (e.g. Media or Comms) don't have these issues. I would expect this category to behave like them, just an organizing category.

Possible temporary solution

Problem can be solved by either deleting the whole category (obviously), setting a Rule that doesn't match anything (e.g. some big Hex-Number: "4BAB231F049AEA1D9") or setting a Regex Rule that also won't match anything but is a bit cleverer (e.g. ".^")

Documentation

Red Banner on 'Activities' Tab:

Error: Request failed with status code 400. See dev console (F12) and/or server logs for more info.

Web Console:

Error: Request failed with status code 400
    at t.exports (createError.js:16)
    at t.exports (settle.js:17)
    at XMLHttpRequest.h.onreadystatechange (xhr.js:59)
vue.runtime.esm.js:1888

Query options:  {timeperiod: {…}, host: "myPC", force: undefined, filterAFK: true}
activity_daily.ts:85

POST http://localhost:5600/api/0/query/ 400 (BAD REQUEST)
xhr.js:172

Linux Server Log:

Traceback (most recent call last):
  File "aw_server/rest.py", line 244, in post
  File "aw_server/api.py", line 245, in query2
  File "site-packages/aw_query/query2.py", line 393, in query
  File "site-packages/aw_query/query2.py", line 371, in interpret
  File "site-packages/aw_query/query2.py", line 123, in interpret
  File "site-packages/aw_query/query2.py", line 269, in interpret
  File "site-packages/aw_query/query2.py", line 269, in interpret
  File "site-packages/aw_query/query2.py", line 204, in interpret
  File "site-packages/aw_query/query2.py", line 56, in interpret
aw_query.exceptions.QueryInterpretException: Tried to reference variable 'null' which is not defined
2019-11-18 19:06:19 [INFO ]: 400 (127.0.0.1): POST /api/0/query/ HTTP/1.1  (flask:25)

Environment

  • ActivityWatch version: v0.8.3
  • OS: Linux (Ubuntu 18.04)
  • Browsers: Vivaldi v2.8.1664.44 (Chromium) and Firefox v70.0.1
    • Vivaldi User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.121 Safari/537.36 Vivaldi/2.8.1664.44
@ErikBjare
Copy link
Member

Thanks for reporting!

We noticed this ourselves a couple of days ago, and will be fixing it shortly. It might take a couple of weeks until there is a new release with the fix included, but we're on it :)

@muhdiboy
Copy link
Author

Great to hear!

As I've noted I have a temporary solution for the meantime.

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