Repository: obsidian-tasks-group/obsidian-tasks (ts)

Issue:
More readable names in 'group by priority'
### ⚠️ Please check that this feature request hasn't been suggested before.

- [X] I searched previous [Ideas in Discussions](https://github.com/obsidian-tasks-group/obsidian-tasks/discussions/categories/ideas-any-new-feature-requests-go-in-issues-please?discussions_q=category%3A%22Ideas%3A+Any+New+Feature+Requests+go+in+Issues+please%22+-label%3A%22status%3A+released%22+-label%3Aduplicate+sort%3Atop) didn't find any similar feature requests.
- [X] I searched previous [Issues](https://github.com/obsidian-tasks-group/obsidian-tasks/issues?q=is%3Aopen+is%3Aissue+label%3A%22type%3A+enhancement%22+sort%3Acomments-desc) didn't find any similar feature requests.

### 🔖 Feature description

Remove the need for numeric prefixes on the titles for `group by priority`, so that the priority names are clearer/more visible.

### ✔️ Solution

Replace `Priority 3: None` with `No Priority`
And similarly, change the names of other priorities to remove the numbers.

Retain the current sort order, to High Priority is first, and Low Priority is last.


### ❓ Alternatives

A more complicated way of achieving this was proposed in #1604.

### 📝 Additional Context

_No response_

Pull request:
feat: 'group by priority' names are now more readable
<!--- Provide a general summary of your changes in the Title above -->

# Description

Change group names from `Priority 1: Highest` to `Highest` (and all others too).

| Old name              | New name           |
| --------------------- | ------------------ |
| `Priority 0: Highest` | `Highest priority` |
| `Priority 1: High`    | `High priority`    |
| `Priority 2: Medium`  | `Medium priority`  |
| `Priority 3: None`    | `Normal priority`  |
| `Priority 4: Low`     | `Low priority`     |
| `Priority 5: Lowest`  | `Lowest priority`  |

## Motivation and Context

Provide shorter group names with only meaningful data.

Fixes #1628

## How has this been tested?

Unit tests (Fixed)

## Types of changes

Changes visible to users:

- [x] **Feature**

## Checklist

- [x] My code follows the code style of this project and passes `yarn run lint`.
- [x] My change requires a change to the documentation.
- [x] 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

<!--
By submitting this pull request, you must agree to follow our
[contributing guide](https://publish.obsidian.md/tasks-contributing) and
[Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md).
Put an x in the boxes to confirm you agree.
-->

- [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/Queries/Grouping.md b/docs/Queries/Grouping.md
index cd9fa7d7..88a6ddd6 100644
--- a/docs/Queries/Grouping.md
+++ b/docs/Queries/Grouping.md
@@ -329,12 +329,12 @@ Since Tasks X.Y.Z, **[[Custom Grouping|custom grouping]] by description** is now
 
 - `group by priority`
   - The priority of the task, namely one of:
-    - `Priority 0: Highest`
-    - `Priority 1: High`
-    - `Priority 2: Medium`
-    - `Priority 3: None`
-    - `Priority 4: Low`
-    - `Priority 5: Lowest`
+    - `Highest priority`
+    - `High priority`
+    - `Medium priority`
+    - `Normal priority`
+    - `Low priority`
+    - `Lowest priority`
 
 > [!released]
 >
@@ -369,9 +369,8 @@ Using the priority number:
 ### Urgency
 
 - `group by urgency` ([[Urgency|urgency]])
-  - Currently, the groups run from the lowest urgency to highest.
+  - The groups run from the highest urgency to the lowest.
   - You can reverse this with `group by urgency reverse`.
-  - In a future release, the default group order will become from the highest urgency to lowest.
 
 > [!released]
 >
diff --git a/src/Query/Filter/PriorityField.ts b/src/Query/Filter/PriorityField.ts
index d0215619..ada0abcd 100644
--- a/src/Query/Filter/PriorityField.ts
+++ b/src/Query/Filter/PriorityField.ts
@@ -95,8 +95,8 @@ export class PriorityField extends Field {
 
     public grouper(): GrouperFunction {
         return (task: Task) => {
-            const priorityName = PriorityTools.priorityNameUsingNone(task.priority);
-            return [`Priority ${task.priority}: ${priorityName}`];
+            const priorityName = PriorityTools.priorityNameUsingNormal(task.priority);
+            return [`%%${task.priority}%%${priorityName} priority`];
         };
     }
 }
diff --git a/src/Query/Filter/UrgencyField.ts b/src/Query/Filter/UrgencyField.ts
index b60d3ea1..e4ef6e09 100644
--- a/src/Query/Filter/UrgencyField.ts
+++ b/src/Query/Filter/UrgencyField.ts
@@ -1,6 +1,6 @@
 import type { Comparator } from '../Sorter';
 import type { Task } from '../../Task';
-import type { GrouperFunction } from '../Grouper';
+import type { Grouper, GrouperFunction } from '../Grouper';
 import { Field } from './Field';
 import { FilterOrErrorMessage } from './Filter';
 
@@ -58,4 +58,16 @@ export class UrgencyField extends Field {
             return [`${task.urgency.toFixed(2)}`];
         };
     }
+
+    /**
+     * The {@link Field.createGrouper} creates a grouper that sorts by increasing values.
+     * For {@link UrgencyField} the group sorting shall be done by decreasing values, so
+     * the normal order here is the reverse of the regular one.
+     *
+     * @param reverse - false for normal group order (from most urgent to less urgent),
+     * true for reverse group order.
+     */
+    public createGrouper(reverse: boolean): Grouper {
+        return super.createGrouper(!reverse);
+    }
 }


Test patch:
diff --git a/tests/Query/Filter/PriorityField.test.ts b/tests/Query/Filter/PriorityField.test.ts
index 233affbb..80fffb26 100644
--- a/tests/Query/Filter/PriorityField.test.ts
+++ b/tests/Query/Filter/PriorityField.test.ts
@@ -200,12 +200,12 @@ describe('grouping by priority', () => {
     });
 
     it.each([
-        ['- [ ] a 🔺', ['Priority 0: Highest']],
-        ['- [ ] a ⏫', ['Priority 1: High']],
-        ['- [ ] a 🔼', ['Priority 2: Medium']],
-        ['- [ ] a', ['Priority 3: None']],
-        ['- [ ] a 🔽', ['Priority 4: Low']],
-        ['- [ ] a ⏬', ['Priority 5: Lowest']],
+        ['- [ ] a 🔺', ['%%0%%Highest priority']],
+        ['- [ ] a ⏫', ['%%1%%High priority']],
+        ['- [ ] a 🔼', ['%%2%%Medium priority']],
+        ['- [ ] a', ['%%3%%Normal priority']],
+        ['- [ ] a 🔽', ['%%4%%Low priority']],
+        ['- [ ] a ⏬', ['%%5%%Lowest priority']],
     ])('task "%s" should have groups: %s', (taskLine: string, groups: string[]) => {
         // Arrange
         const grouper = new PriorityField().createNormalGrouper().grouper;
@@ -219,12 +219,12 @@ describe('grouping by priority', () => {
         const tasks = SampleTasks.withAllPriorities();
 
         expect({ grouper, tasks }).groupHeadingsToBe([
-            'Priority 0: Highest',
-            'Priority 1: High',
-            'Priority 2: Medium',
-            'Priority 3: None',
-            'Priority 4: Low',
-            'Priority 5: Lowest',
+            '%%0%%Highest priority',
+            '%%1%%High priority',
+            '%%2%%Medium priority',
+            '%%3%%Normal priority',
+            '%%4%%Low priority',
+            '%%5%%Lowest priority',
         ]);
     });
 });
diff --git a/tests/Query/Filter/UrgencyField.test.ts b/tests/Query/Filter/UrgencyField.test.ts
index aa2dc751..2a05cd7f 100644
--- a/tests/Query/Filter/UrgencyField.test.ts
+++ b/tests/Query/Filter/UrgencyField.test.ts
@@ -98,7 +98,7 @@ describe('grouping by urgency', () => {
     });
 
     it('should sort groups for UrgencyField', () => {
-        const grouper = new UrgencyField().createNormalGrouper();
+        const grouper = new UrgencyField().createReverseGrouper();
         const taskLines = ['- [ ] a ⏫', '- [ ] a 🔼', '- [ ] a', '- [ ] a 🔽'];
         const tasks = taskLines.map((taskLine) => fromLine({ line: taskLine }));