jason0x43 / alfred-toggl

Alfred Workflow for interacting with the Toggl time tracking service
MIT License
367 stars 16 forks source link

How can I go directly to 'report -> this week' from a hotkey? #27

Closed nikitavoloboev closed 7 years ago

jason0x43 commented 7 years ago

Hmmm...it would definitely involve an extra action in the workflow, and currently an action couldn't directly trigger a weekly report (well, not without some extra scripting). I could rework where the date span calculation happens, which would make this pretty straightforward.

nikitavoloboev commented 7 years ago

Yeah, an extra action would be indeed really nice. I just want to bind a hotkey to an action of viewing my report for 'this week' as that is the only repot I look at and I want to skip the steps of getting to it every time though the menu.

Thank you.

nikitavoloboev commented 7 years ago

Also I have a question, does the week report range from Monday to Sunday? Or perhaps some other date?

It's just that I tried running the report this sunday and it showed no results and I found it quite strange.

nikitavoloboev commented 7 years ago

Having action going directly to 'reports' would work too for me. As I can easily go to the correct time period after. Can this be already done perhaps?

jason0x43 commented 7 years ago

I added support for this in 2.1.0. The support is in 2 parts:

  1. The report command can now handle symbolic names (today, yesterday, week) for the report span (this is only relevant when messing with the workflow block)
  2. I added an example block that binds "ctrl-alt-cmd-R" to the report for this week

Give that a try.

Also I have a question, does the week report range from Monday to Sunday? Or perhaps some other date?

It should be Sunday - Saturday (it's based on Go's day numbering). I have a TODO item in there about making the work week configurable.

nikitavoloboev commented 7 years ago

Ok, I downloaded it but it seems to not work at all now. I mean I logged in correctly but now when the menu shows up :

2016-10-11 at 20 47

Pressing enter on any of the fields does nothing.

jason0x43 commented 7 years ago

Hmmm... If you open the workflow in Alfred's preferences and open the debug log, do any errors show up when you try to action one of the menu items? Does tgp work? (It's basically the same as selecting 'projects' and hitting enter.)

nikitavoloboev commented 7 years ago

Yeah, you are right. Here are the logs I get for errors :

2016-10-12 at 00 06

And in text :

Starting debug for 'toggl'

[2016-10-12 00:06:33][STDERR: input.scriptfilter] [alfred] 2016/10/12 00:06:33 Alfred version: 3.1.1
[toggl] 2016/10/12 00:06:33 Using config file: /Users/nikivi/Library/Application Support/Alfred 3/Workflow Data/com.jason0x43.alfred-toggl/config.json
[toggl] 2016/10/12 00:06:33 Using cache file: /Users/nikivi/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.jason0x43.alfred-toggl/cache.json
[toggl] 2016/10/12 00:06:33 Error loading config: open /Users/nikivi/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.jason0x43.alfred-toggl/cache.json: no such file or directory
[alfred] 2016/10/12 00:06:33 set keyword to ''
[alfred] 2016/10/12 00:06:33 tell: data=alfred.workflowData{Keyword:"", Mode:"tell", Mod:"", Data:""}, arg=''
[alfred] 2016/10/12 00:06:33 Adding menu item for 'status'
[alfred] 2016/10/12 00:06:33 Skipping disabled command 'login'
[alfred] 2016/10/12 00:06:33 Skipping disabled command 'token'
[alfred] 2016/10/12 00:06:33 Adding menu item for 'timers'
[alfred] 2016/10/12 00:06:33 Adding menu item for 'projects'
[alfred] 2016/10/12 00:06:33 Adding menu item for 'tag'
[alfred] 2016/10/12 00:06:33 Adding menu item for 'report'
[alfred] 2016/10/12 00:06:33 Adding menu item for 'options'
[alfred] 2016/10/12 00:06:33 Adding menu item for 'logout'
[alfred] 2016/10/12 00:06:33 Adding menu item for 'reset'
[alfred] 2016/10/12 00:06:33 Fuzzy sorting items
[2016-10-12 00:06:34][ERROR: action.script] [alfred] 2016/10/12 00:06:34 Alfred version: 3.1.1
[toggl] 2016/10/12 00:06:34 Using config file: /Users/nikivi/Library/Application Support/Alfred 3/Workflow Data/com.jason0x43.alfred-toggl/config.json
[toggl] 2016/10/12 00:06:34 Using cache file: /Users/nikivi/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.jason0x43.alfred-toggl/cache.json
[toggl] 2016/10/12 00:06:34 Error loading config: open /Users/nikivi/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.jason0x43.alfred-toggl/cache.json: no such file or directory
jason0x43 commented 7 years ago

Hmmm...errors for missing files aren't necessarily problematic, and if it's showing you the main menu, then it's loading the config properly. (That "Error loading config" message is actually for the cache file.) I'd expect you to have a cache file, though.

Does the directory /Users/nikivi/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.jason0x43.alfred-toggle exist?

nikitavoloboev commented 7 years ago

It exists but it is empty.

nikitavoloboev commented 7 years ago

Still have the issue of all options being unclickable, should I just try and reinstall the workflow?

jason0x43 commented 7 years ago

Sorry about the delay; just got back from vacation. :) Anyway, you could try that. It's not clear from the debug log exactly what's wrong. You've logged in successfully and the config file has been created, because it's showing you the logged-in menu items.

Another thing would be to try actioning the "status" item and see if a cache is created. That will download your time entries from Toggl. It should be doing that by default when you don't have any cached data, but maybe there's an issue there.

nikitavoloboev commented 7 years ago

Hey Jason,

It is working now. :)

nikitavoloboev commented 7 years ago

I especially love how report is on the top of the list now. It is extremely handy for me.

jason0x43 commented 7 years ago

Great, glad to hear it's working!