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

Allow custom priorities #275

Open
nkakouros opened this issue Jun 23, 2020 · 1 comment
Open

Allow custom priorities #275

nkakouros opened this issue Jun 23, 2020 · 1 comment

Comments

@nkakouros
Copy link
Contributor

In the taskrc file, one can have:

uda.priority.values = H,M,,L,0
urgency.uda.priority.H.coefficient=20
urgency.uda.priority..coefficient=1.8
urgency.uda.priority.L.coefficient=-1
urgency.uda.priority.0.coefficient=-100

This works fine with task on the cli. Only thing not working is bash completion for the 0 priority.

In taskwiki, if I try to modify a task and assign 0 priority to it, I get:

Error invoking 'python_execute' on channel 3 (python3-script-host):                                                                                                                                                                          
Traceback (most recent call last):                                                                                                                                                                                                           
  File "<string>", line 1, in <module>                                                                                                                                                                                                       
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/errors.py", line 26, in wrapped_function                                                                                                                                     
    original_function(*args, **kwargs)                                                                                                                                                                                                       
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/main.py", line 222, in modify                                                                                                                                                
    cache().update_vwtasks_in_buffer()                                                                                                                                                                                                       
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/cache.py", line 202, in update_vwtasks_in_buffer                                                                                                                             
    task.update_in_buffer()                                                                                                                                                                                                                  
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/vwtask.py", line 321, in update_in_buffer                                                                                                                                    
    self.cache.buffer[self['line_number']] = str(self)                                                                                                                                                                                       
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/vwtask.py", line 338, in __str__                                                                                                                                             
    ' ' + '!' * self.priority_from_tw_format if self['priority'] else '',                                                                                                                                                                    
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/vwtask.py", line 244, in priority_from_tw_format                                                                                                                             
    return convert_priority_from_tw_format(self.task['priority'])                                                                                                                                                                            
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/vwtask.py", line 15, in convert_priority_from_tw_format                                                                                                                      
    return {None: None, 'L': 1, 'M': 2, 'H': 3}[priority]                                                                                                                                                                                    
KeyError: '0'                                                                                                                                                                                                                                

The dict with the priorities should not be hardcoded, but read from the taskrc.

@sdondley
Copy link

I'm getting the same errors. I have a different system for my priorities than the author:

urgency.user.tag.qst.coefficient=8.0
urgency.user.tag.qsn.coefficient=8.0
urgency.user.tag.q.coefficient=8.0
urgency.blocking.coefficient=0.0
uda.priority.values=U,H,M,,L

urgency.uda.priority.U.coefficient=10.0
urgency.uda.priority.H.coefficient=6.0
urgency.uda.priority.M.coefficient=3.9
urgency.uda.priority.L.coefficient=-5.0

I looked at the patch provided in #304 but that seems to hard code in the priorities the author uses, AFAICT. What can I do to resolve this?

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

No branches or pull requests

2 participants