obsidian-tasks: Calculates wrong urgency score for due date
Expected Behavior
I have the following two tasks:
- [ ] task 1 - actionable with default prio
- [ ] task 2 - something in ten years with low prio 🔽 📅 2032-01-01
When ordering them by urgency, I expect that task 1 shows up first, and then task 2.
This should work according to the documented urgency scores.
The scores should be
- 0 (no due date) + 1.95 (default prio) = 1.95 for task 1, and
- 0.2 (due in future) + 0 (low prio) = 0.2 for task 2,
so task 1 should come first.
Current Behavior
Task 2 is shown first, then task 1.
Steps to Reproduce
Use this to show the tasks above:
sort by urgency
Context (Environment)
- Obsidian version: 0.14.13
- Tasks version: 1.5.1
Possible Solution
The problem seems to be that the urgency for the due date is not calculated correctly. The score of 0.2 for a “due date far in the future” is multiplied with the due coefficient of 12, so the actual score is 2.4 instead of 0.2 which is higher than the priority of a task with default priority (1.95). I think the constant 0.2 that appears two times in the function for the calculation of the urgency should be actually 1/60.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 37 (16 by maintainers)
Of course I’m not saying that my simple formula is the best solution. We may consider other variants, like exponential increase of urgency instead of linear. Or multiplying the individual scores instead of adding them up.
Here are some links for inspiration and reference:
OK I understand your perspective. My life is different, and I use due dates differently. Others will use it different to both you and me.
The thing I’m learning is that Tasks is an incredibly flexible tool, and many people use it in many different ways. I feel it’s important that any changes and additions are designed in a way that they don’t enforce - or seem to enforce - a particular structure or style or vocabulary of working.
I am currently prioritising other areas, so won’t make any decisions in a rush. And I’ll look at your references before making any decisions.
Many thanks for your time and info!
@claremacrae Thanks a lot for your help. I’m sure we will eventually come up with something reasonable. It needs a little time to think it through, but I it will be worthwile, and would make Obsidian Tasks stand out, because most other apps do not support such computed scores for automatic ranking, or they also have similar problems. My Life Organized is one of the few apps which does it, but unfortunately it also does it wrong in that it considers tasks with no due date like tasks due today (instead of like tasks due far in the future), and similar for tasks with no start date. Such seemingly small mistakes in the computed score formula can make the whole automatic sorting feature unusable.
Btw, I also advocate renaming the “urgency” score to something else, because it is not only based on urgency (dates) but also on importance (priority), and not try to emulate TaskWarrior but we should come up with our own more reasonable formula.
OK thanks for the suggestions, everyone. Much appreciated.
Just for context, I picked this up this morning as I thought it would be an easy thing to add tests for and then fix, and it would be a quick enabler for an easy small feature.
As it’s turned out to be more complicated and less certain than I first thought, I’m putting it down for now. Will mull it over another day.
At least the things I learned from writing the tests will still be helpful on other features.
So maybe it should not be hardcoded as 1/60, but set to 0.2/dueCoefficient.
The original constant (from TaskWarrior) was 0.2. However, in our function, after the calculation of the score, it is multiplied with the dueCoefficient = 12. So to get the original constant of 0.2, you need to divide it by 12 to compensate the following multiplication, and 0.2 / 12 = 1 / 60.