Repository: obsidian-tasks-group/obsidian-tasks
Pull request #2067 (2023-06-26 15:30:09)

refactor: use PriorityTools in TaskLineRenderer.ts
<!--- Provide a general summary of your changes in the Title above -->

# Description

Call `priorityNameUsingNormal()` instead of clunky `if-else` statements.

## Motivation and Context

Reuse existing methods, remove static values.

## How has this been tested?

Tests in `TaskLineRenderer.test.ts` shall be enough. Tried also to break the code by putting wrong values in `priorityNameUsingNormal()` output (All broken but `Highest` and `Lowest` broken, which makes sense as they have been added recently.

## Screenshots (if appropriate)

## Types of changes

Internal changes:

- [x] **Refactor** (prefix: `refactor` - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [x] My code follows the code style of this project and passes `yarn run lint`.
- [ ] My change requires a change to the documentation.
- [ ] I have [updated the documentation](https://publish.obsidian.md/tasks-contributing/Documentation/About+Documentation) accordingly.
- [x] My change has adequate [Unit Test coverage](https://publish.obsidian.md/tasks-contributing/Testing/About+Testing).

## Terms

- [x] My contribution follow this project's [contributing guide](https://publish.obsidian.md/tasks-contributing)
- [x] I agree to follow this project's [Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md)



Patch:
diff --git a/docs/Advanced/Urgency.md b/docs/Advanced/Urgency.md
index d3d2e449..d7227176 100644
--- a/docs/Advanced/Urgency.md
+++ b/docs/Advanced/Urgency.md
@@ -29,6 +29,8 @@ As you can tell from the table below, **due dates have the strongest influence o
 
 The scores are as follows:
 
+<!-- placeholder to force blank line before included text --> <!-- include: DocsSamplesForUrgency.test.UrgencyTable_urgency-html-table.approved.md -->
+
 <table>
 <thead>
   <tr>
@@ -38,24 +40,105 @@ The scores are as follows:
 </thead>
 <tbody>
   <tr>
-    <td rowspan="5">Due</td>
-    <td>More than 7 days overdue</td>
-    <td><code>12.0</code></td>
+    <td rowspan="25">Due</td>
+    <td>due more than 7 days ago</td>
+    <td><code>12.00000</code></td>
+  </tr>
+  <tr>
+    <td>due 7 days ago</td>
+    <td><code>12.00000</code></td>
+  </tr>
+  <tr>
+    <td>due 6 days ago</td>
+    <td><code>11.54286</code></td>
+  </tr>
+  <tr>
+    <td>due 5 days ago</td>
+    <td><code>11.08571</code></td>
+  </tr>
+  <tr>
+    <td>due 4 days ago</td>
+    <td><code>10.62857</code></td>
+  </tr>
+  <tr>
+    <td>due 3 days ago</td>
+    <td><code>10.17143</code></td>
   </tr>
   <tr>
-    <td rowspan="2">Due between 7 days ago and in 14 days</td>
-    <td>Range of <code>12.0</code> to <code>0.2</code></td>
+    <td>due 2 days ago</td>
+    <td><code>9.71429</code></td>
   </tr>
   <tr>
-    <td>Example for "today": <code>9.0</code></td>
+    <td>due 1 day ago</td>
+    <td><code>9.25714</code></td>
+  </tr>
+  <tr>
+    <td>Today</td>
+    <td><code>8.80000</code></td>
+  </tr>
+  <tr>
+    <td>1 day until due</td>
+    <td><code>8.34286</code></td>
+  </tr>
+  <tr>
+    <td>2 days until due</td>
+    <td><code>7.88571</code></td>
+  </tr>
+  <tr>
+    <td>3 days until due</td>
+    <td><code>7.42857</code></td>
+  </tr>
+  <tr>
+    <td>4 days until due</td>
+    <td><code>6.97143</code></td>
+  </tr>
+  <tr>
+    <td>5 days until due</td>
+    <td><code>6.51429</code></td>
+  </tr>
+  <tr>
+    <td>6 days until due</td>
+    <td><code>6.05714</code></td>
+  </tr>
+  <tr>
+    <td>7 days until due</td>
+    <td><code>5.60000</code></td>
+  </tr>
+  <tr>
+    <td>8 days until due</td>
+    <td><code>5.14286</code></td>
+  </tr>
+  <tr>
+    <td>9 days until due</td>
+    <td><code>4.68571</code></td>
+  </tr>
+  <tr>
+    <td>10 days until due</td>
+    <td><code>4.22857</code></td>
+  </tr>
+  <tr>
+    <td>11 days until due</td>
+    <td><code>3.77143</code></td>
+  </tr>
+  <tr>
+    <td>12 days until due</td>
+    <td><code>3.31429</code></td>
+  </tr>
+  <tr>
+    <td>13 days until due</td>
+    <td><code>2.85714</code></td>
+  </tr>
+  <tr>
+    <td>14 days until due</td>
+    <td><code>2.40000</code></td>
   </tr>
   <tr>
     <td>More than 14 days until due</td>
-    <td><code>0.2</code></td>
+    <td><code>2.40000</code></td>
   </tr>
   <tr>
     <td>None</td>
-    <td><code>0.0</code></td>
+    <td><code>0.00000</code></td>
   </tr>
   <tr>
     <td rowspan="6">Priority</td>
@@ -96,7 +179,7 @@ The scores are as follows:
     <td><code>0.0</code></td>
   </tr>
   <tr>
-    <td rowspan="3">Starts</td>
+    <td rowspan="3">Start</td>
     <td>Today or earlier</td>
     <td><code>0.0</code></td>
   </tr>
@@ -111,11 +194,13 @@ The scores are as follows:
 </tbody>
 </table>
 
+<!-- placeholder to force blank line after included text --> <!-- endInclude -->
+
 ## Examples
 
 ```markdown
 A task that is due today, has a "medium" priority, is not scheduled, and has no start date:
-urgency = 9.0 + 3.9 + 0.0 + 0.0 = 12.9
+urgency = 8.8 + 3.9 + 0.0 + 0.0 = 12.7
 
 A task that has no due date, a "high" priority, is scheduled for yesterday, and started yesterday:
 urgency = 0.0 + 6.0 + 5.0 + 0.0 = 11.0
diff --git a/src/TaskLineRenderer.ts b/src/TaskLineRenderer.ts
index efcc9868..100ca77b 100644
--- a/src/TaskLineRenderer.ts
+++ b/src/TaskLineRenderer.ts
@@ -7,6 +7,7 @@ import { TaskLayout } from './TaskLayout';
 import { replaceTaskWithTasks } from './File';
 import { TASK_FORMATS, getSettings } from './Config/Settings';
 import { GlobalFilter } from './Config/GlobalFilter';
+import { PriorityTools } from './lib/PriorityTools';
 
 export type TaskLineRenderDetails = {
     parentUlElement: HTMLElement;
@@ -250,15 +251,14 @@ export type AttributesDictionary = { [key: string]: string };
 function getComponentClassesAndData(component: TaskLayoutComponent, task: Task): [string[], AttributesDictionary] {
     const genericClasses: string[] = [];
     const dataAttributes: AttributesDictionary = {};
-    const setDateAttribute = (date: Moment, attributeName: string) => {
-        const dateValue = dateToAttribute(date);
-        if (dateValue) dataAttributes[attributeName] = dateValue;
-    };
 
     function addDateClassesAndName(date: moment.Moment | null, classes: string, attributeName: string) {
         if (date) {
             genericClasses.push(classes);
-            setDateAttribute(date, attributeName);
+            const dateValue = dateToAttribute(date);
+            if (dateValue) {
+                dataAttributes[attributeName] = dateValue;
+            }
         }
     }
 
@@ -267,14 +267,7 @@ function getComponentClassesAndData(component: TaskLayoutComponent, task: Task):
             genericClasses.push(LayoutClasses.description);
             break;
         case 'priority': {
-            let priorityValue = null;
-            if (task.priority === taskModule.Priority.Highest) priorityValue = 'highest';
-            else if (task.priority === taskModule.Priority.High) priorityValue = 'high';
-            else if (task.priority === taskModule.Priority.Medium) priorityValue = 'medium';
-            else if (task.priority === taskModule.Priority.Low) priorityValue = 'low';
-            else if (task.priority === taskModule.Priority.Lowest) priorityValue = 'lowest';
-            else priorityValue = 'normal';
-            dataAttributes['taskPriority'] = priorityValue;
+            dataAttributes['taskPriority'] = PriorityTools.priorityNameUsingNormal(task.priority).toLocaleLowerCase();
             genericClasses.push(LayoutClasses.priority);
             break;
         }
diff --git a/src/Urgency.ts b/src/Urgency.ts
index 1b771fe4..a26535aa 100644
--- a/src/Urgency.ts
+++ b/src/Urgency.ts
@@ -13,7 +13,8 @@ export class Urgency {
 
         if (task.dueDate !== null) {
             // Map a range of 21 days to the value 0.2 - 1.0
-            const daysOverdue = Math.round(window.moment().diff(task.dueDate) / Urgency.milliSecondsPerDay);
+            const startOfToday = window.moment().startOf('day');
+            const daysOverdue = Math.round(startOfToday.diff(task.dueDate) / Urgency.milliSecondsPerDay);
 
             let dueMultiplier: number;
             if (daysOverdue >= 7.0) {


Test patch:
diff --git a/resources/sample_vaults/Tasks-Demo/Manual Testing/Urgency Scores Examples.md b/resources/sample_vaults/Tasks-Demo/Manual Testing/Urgency Scores Examples.md
new file mode 100644
index 00000000..6d4c9c40
--- /dev/null
+++ b/resources/sample_vaults/Tasks-Demo/Manual Testing/Urgency Scores Examples.md
@@ -0,0 +1,36 @@
+# Urgency Scores Examples
+
+## Purpose
+
+This note contains the Urgency worked examples that are used in the user docs at:
+<https://publish.obsidian.md/tasks/Advanced/Urgency#Examples>
+
+They group tasks by their scores, to confirm that the calculated scores agree with the values in the documentation.
+
+## Tasks
+
+- [ ] #task 1 A task that is due today, has a "medium" priority, is not scheduled, and has no start date - **urgency should be 12.70**: 🔼 📅 2023-06-26
+
+urgency = 8.8 + 3.9 + 0.0 + 0.0 = 12.7
+
+---
+
+- [ ] #task 2 A task that has no due date, a "high" priority, is scheduled for yesterday, and started yesterday - **urgency should be 11.00**: ⏫ 🛫 2023-06-25 ⏳ 2023-06-25
+
+urgency = 0.0 + 6.0 + 5.0 + 0.0 = 11.0
+
+---
+
+- [ ] #task 3 A task that has no due date, a "high" priority, is scheduled for tomorrow, and starts tomorrow - **urgency should be 3.00**: ⏫ 🛫 2023-06-27 ⏳ 2023-06-27
+
+urgency = 0.0 + 6.0 + 0.0 - 3.0 = 3.0
+
+---
+
+## Search
+
+```tasks
+filename includes Urgency Scores Examples
+group by urgency
+group by function task.due.formatAsDateAndTime()
+```
diff --git a/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.UrgencyTable_urgency-html-table.approved.md b/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.UrgencyTable_urgency-html-table.approved.md
new file mode 100644
index 00000000..9989137b
--- /dev/null
+++ b/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.UrgencyTable_urgency-html-table.approved.md
@@ -0,0 +1,168 @@
+<!-- placeholder to force blank line before included text -->
+
+
+<table>
+<thead>
+  <tr>
+    <th colspan="2">Property</th>
+    <th>Score</th>
+  </tr>
+</thead>
+<tbody>
+  <tr>
+    <td rowspan="25">Due</td>
+    <td>due more than 7 days ago</td>
+    <td><code>12.00000</code></td>
+  </tr>
+  <tr>
+    <td>due 7 days ago</td>
+    <td><code>12.00000</code></td>
+  </tr>
+  <tr>
+    <td>due 6 days ago</td>
+    <td><code>11.54286</code></td>
+  </tr>
+  <tr>
+    <td>due 5 days ago</td>
+    <td><code>11.08571</code></td>
+  </tr>
+  <tr>
+    <td>due 4 days ago</td>
+    <td><code>10.62857</code></td>
+  </tr>
+  <tr>
+    <td>due 3 days ago</td>
+    <td><code>10.17143</code></td>
+  </tr>
+  <tr>
+    <td>due 2 days ago</td>
+    <td><code>9.71429</code></td>
+  </tr>
+  <tr>
+    <td>due 1 day ago</td>
+    <td><code>9.25714</code></td>
+  </tr>
+  <tr>
+    <td>Today</td>
+    <td><code>8.80000</code></td>
+  </tr>
+  <tr>
+    <td>1 day until due</td>
+    <td><code>8.34286</code></td>
+  </tr>
+  <tr>
+    <td>2 days until due</td>
+    <td><code>7.88571</code></td>
+  </tr>
+  <tr>
+    <td>3 days until due</td>
+    <td><code>7.42857</code></td>
+  </tr>
+  <tr>
+    <td>4 days until due</td>
+    <td><code>6.97143</code></td>
+  </tr>
+  <tr>
+    <td>5 days until due</td>
+    <td><code>6.51429</code></td>
+  </tr>
+  <tr>
+    <td>6 days until due</td>
+    <td><code>6.05714</code></td>
+  </tr>
+  <tr>
+    <td>7 days until due</td>
+    <td><code>5.60000</code></td>
+  </tr>
+  <tr>
+    <td>8 days until due</td>
+    <td><code>5.14286</code></td>
+  </tr>
+  <tr>
+    <td>9 days until due</td>
+    <td><code>4.68571</code></td>
+  </tr>
+  <tr>
+    <td>10 days until due</td>
+    <td><code>4.22857</code></td>
+  </tr>
+  <tr>
+    <td>11 days until due</td>
+    <td><code>3.77143</code></td>
+  </tr>
+  <tr>
+    <td>12 days until due</td>
+    <td><code>3.31429</code></td>
+  </tr>
+  <tr>
+    <td>13 days until due</td>
+    <td><code>2.85714</code></td>
+  </tr>
+  <tr>
+    <td>14 days until due</td>
+    <td><code>2.40000</code></td>
+  </tr>
+  <tr>
+    <td>More than 14 days until due</td>
+    <td><code>2.40000</code></td>
+  </tr>
+  <tr>
+    <td>None</td>
+    <td><code>0.00000</code></td>
+  </tr>
+  <tr>
+    <td rowspan="6">Priority</td>
+    <td>Highest</td>
+    <td><code>9.0</code></td>
+  </tr>
+  <tr>
+    <td>High</td>
+    <td><code>6.0</code></td>
+  </tr>
+  <tr>
+    <td>Medium</td>
+    <td><code>3.9</code></td>
+  </tr>
+  <tr>
+    <td>None</td>
+    <td><code>1.95</code></td>
+  </tr>
+  <tr>
+    <td>Low</td>
+    <td><code>0.0</code></td>
+  </tr>
+  <tr>
+    <td>Lowest</td>
+    <td><code>-1.8</code></td>
+  </tr>
+  <tr>
+    <td rowspan="3">Scheduled</td>
+    <td>Today or earlier</td>
+    <td><code>5.0</code></td>
+  </tr>
+  <tr>
+    <td>Tomorrow or later</td>
+    <td><code>0.0</code></td>
+  </tr>
+  <tr>
+    <td>None</td>
+    <td><code>0.0</code></td>
+  </tr>
+  <tr>
+    <td rowspan="3">Start</td>
+    <td>Today or earlier</td>
+    <td><code>0.0</code></td>
+  </tr>
+  <tr>
+    <td>Tomorrow or later</td>
+    <td><code>-3.0</code></td>
+  </tr>
+  <tr>
+    <td>None</td>
+    <td><code>0.0</code></td>
+  </tr>
+</tbody>
+</table>
+
+
+<!-- placeholder to force blank line after included text -->
diff --git a/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.ts b/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.ts
new file mode 100644
index 00000000..e1cd7944
--- /dev/null
+++ b/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.ts
@@ -0,0 +1,153 @@
+/**
+ * @jest-environment jsdom
+ */
+
+import moment from 'moment';
+
+import { verifyMarkdownForDocs } from '../../TestingTools/VerifyMarkdownTable';
+import { TaskBuilder } from '../../TestingTools/TaskBuilder';
+import { Urgency } from '../../../src/Urgency';
+import { Priority } from '../../../src/Task';
+
+window.moment = moment;
+
+const today = '2023-05-10';
+beforeEach(() => {
+    jest.useFakeTimers();
+    jest.setSystemTime(new Date(today));
+});
+
+afterEach(() => {
+    jest.useRealTimers();
+});
+
+/**
+ * This test generates the HTML table in the user docs that shows how various Task
+ * signifiers affect the Urgency calculate:
+ * https://publish.obsidian.md/tasks/Advanced/Urgency
+ */
+describe('UrgencyTable', () => {
+    function cell(text: string, span: number = 0): string {
+        if (span !== 0) {
+            return `<td rowspan="${span}">${text}</td>`;
+        } else {
+            return `<td>${text}</td>`;
+        }
+    }
+
+    function urgencyValue(urgency: number, dps: number = 1): string {
+        return `<code>${urgency.toFixed(dps)}</code>`;
+    }
+
+    function urgencyCell(urgency: number, dps: number = 1): string {
+        return cell(`${urgencyValue(urgency, dps)}`);
+    }
+
+    function row(cells: string[]) {
+        let result = '';
+        result += '  <tr>\n';
+        for (const cell of cells) {
+            result += `    ${cell}\n`;
+        }
+        result += '  </tr>\n';
+        return result;
+    }
+
+    function property(rows: string[][]) {
+        let result = '';
+        for (const rowCells of rows) {
+            result += row(rowCells);
+        }
+        return result;
+    }
+
+    function calcForPriority(priority: Priority) {
+        const task = new TaskBuilder().priority(priority).build();
+        return Urgency.calculate(task);
+    }
+
+    function dueCell(date: string) {
+        const task = new TaskBuilder().dueDate(date).priority(Priority.Low).build();
+        return urgencyCell(Urgency.calculate(task), 5);
+    }
+
+    function scheduledCell(date: string) {
+        const task = new TaskBuilder().scheduledDate(date).priority(Priority.Low).build();
+        return urgencyCell(Urgency.calculate(task), 1);
+    }
+
+    function startsCell(date: string) {
+        const task = new TaskBuilder().startDate(date).priority(Priority.Low).build();
+        return urgencyCell(Urgency.calculate(task), 1);
+    }
+
+    it('urgency-html-table', () => {
+        const heading = `
+<table>
+<thead>
+  <tr>
+    <th colspan="2">Property</th>
+    <th>Score</th>
+  </tr>
+</thead>
+<tbody>
+`;
+
+        let table = '';
+        table += heading;
+
+        table += property([
+            [cell('Due', 25), cell('due more than 7 days ago'), dueCell('2023-05-02')],
+            [cell('due 7 days ago'), dueCell('2023-05-03')],
+            [cell('due 6 days ago'), dueCell('2023-05-04')],
+            [cell('due 5 days ago'), dueCell('2023-05-05')],
+            [cell('due 4 days ago'), dueCell('2023-05-06')],
+            [cell('due 3 days ago'), dueCell('2023-05-07')],
+            [cell('due 2 days ago'), dueCell('2023-05-08')],
+            [cell('due 1 day ago'), dueCell('2023-05-09')],
+            [cell('Today'), dueCell('2023-05-10')],
+            [cell('1 day until due'), dueCell('2023-05-11')],
+            [cell('2 days until due'), dueCell('2023-05-12')],
+            [cell('3 days until due'), dueCell('2023-05-13')],
+            [cell('4 days until due'), dueCell('2023-05-14')],
+            [cell('5 days until due'), dueCell('2023-05-15')],
+            [cell('6 days until due'), dueCell('2023-05-16')],
+            [cell('7 days until due'), dueCell('2023-05-17')],
+            [cell('8 days until due'), dueCell('2023-05-18')],
+            [cell('9 days until due'), dueCell('2023-05-19')],
+            [cell('10 days until due'), dueCell('2023-05-20')],
+            [cell('11 days until due'), dueCell('2023-05-21')],
+            [cell('12 days until due'), dueCell('2023-05-22')],
+            [cell('13 days until due'), dueCell('2023-05-23')],
+            [cell('14 days until due'), dueCell('2023-05-24')],
+            [cell('More than 14 days until due'), dueCell('2023-05-25')],
+            [cell('None'), dueCell('')],
+        ]);
+
+        table += property([
+            [cell('Priority', 6), cell('Highest'), urgencyCell(calcForPriority(Priority.Highest))],
+            [cell('High'), urgencyCell(calcForPriority(Priority.High))],
+            [cell('Medium'), urgencyCell(calcForPriority(Priority.Medium))],
+            [cell('None'), urgencyCell(calcForPriority(Priority.None), 2)],
+            [cell('Low'), urgencyCell(calcForPriority(Priority.Low))],
+            [cell('Lowest'), urgencyCell(calcForPriority(Priority.Lowest))],
+        ]);
+
+        table += property([
+            [cell('Scheduled', 3), cell('Today or earlier'), scheduledCell('2023-05-10')],
+            [cell('Tomorrow or later'), scheduledCell('2023-05-11')],
+            [cell('None'), scheduledCell('')],
+        ]);
+
+        table += property([
+            [cell('Start', 3), cell('Today or earlier'), startsCell('2023-05-10')],
+            [cell('Tomorrow or later'), startsCell('2023-05-11')],
+            [cell('None'), startsCell('')],
+        ]);
+
+        table += `</tbody>
+</table>
+`;
+        verifyMarkdownForDocs(table);
+    });
+});
diff --git a/tests/Query/Urgency.test.ts b/tests/Query/Urgency.test.ts
index 38bc7355..ff508aaf 100644
--- a/tests/Query/Urgency.test.ts
+++ b/tests/Query/Urgency.test.ts
@@ -7,6 +7,7 @@ import { TaskBuilder } from '../TestingTools/TaskBuilder';
 import { Urgency } from '../../src/Urgency';
 import { Priority } from '../../src/Task';
 import { calculateRelativeDate } from '../TestingTools/DateTestHelpers';
+import { fromLine } from '../TestHelpers';
 
 window.moment = moment;
 
@@ -40,13 +41,44 @@ function lowPriorityBuilder() {
     return new TaskBuilder().priority(Priority.Low);
 }
 
+// -----------------------------------------------------------------
+// Time of day does not affect result
+
+describe('urgency - test time-of-day impact on due-date score', () => {
+    // Test to reproduce https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2068
+    beforeEach(() => {
+        jest.useFakeTimers();
+    });
+
+    afterEach(() => {
+        jest.useRealTimers();
+    });
+
+    const task = fromLine({ line: '- [ ] #task 🔽 📅 2023-06-26', path: 'a/b/c.md', precedingHeader: null });
+
+    it.each([
+        // Force new line for each time
+        ['00:00'],
+        ['00:01'],
+        ['06:00'],
+        ['09:00'],
+        ['11:59'],
+        ['12:00'],
+        ['12:01'],
+        ['19:00'],
+        ['23:59'],
+    ])('with time  "%s"', (time: string) => {
+        jest.setSystemTime(new Date('2023-06-26 ' + time));
+        expect(Urgency.calculate(task)).toEqual(8.8);
+    });
+});
+
 // -----------------------------------------------------------------
 // Priority tests
 
 describe('urgency - priority component', () => {
     it('should score correctly for priority', () => {
         const builder = new TaskBuilder();
-        // I don't really know what values should I put here
         testUrgency(builder.priority(Priority.Highest), 9.0);
         testUrgency(builder.priority(Priority.High), 6.0);
         testUrgency(builder.priority(Priority.Medium), 3.9);
@@ -74,17 +106,17 @@ describe('urgency - due date component', () => {
 
     it('Due between 7 days ago and in 14 days: Range of 12.0 to 0.2', () => {
         testUrgencyForDueDate(-7, 12.0);
-        testUrgencyForDueDate(0, 8.8); // documentation says: 9.0 for "today"
+        testUrgencyForDueDate(0, 8.8);
         testUrgencyForDueDate(1, 8.34286);
         testUrgencyForDueDate(6, 6.05714);
         testUrgencyForDueDate(13, 2.85714);
-        testUrgencyForDueDate(14, 2.4); // documentation says: 0.2
+        testUrgencyForDueDate(14, 2.4);
     });
 
     it('More than 14 days until due: 0.2', () => {
-        testUrgencyForDueDate(15, 2.4); // // documentation says: 0.2
-        testUrgencyForDueDate(40, 2.4); // // documentation says: 0.2
-        testUrgencyForDueDate(200, 2.4); // // documentation says: 0.2
+        testUrgencyForDueDate(15, 2.4);
+        testUrgencyForDueDate(40, 2.4);
+        testUrgencyForDueDate(200, 2.4);
     });
 
     it('not due: 0.0', () => {