Skip to content

Commit 29fced0

Browse files
committed
docs: Add simple samples for custom grouping with task.id & task.blockedBy
1 parent f871f44 commit 29fced0

6 files changed

+113
-0
lines changed

docs/Queries/Grouping.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,17 @@ For more information, see [[Task Dependencies]].
177177

178178
Since Tasks X.Y.Z, **[[Custom Grouping|custom grouping]] by Id** is now possible, using `task.id`.
179179

180+
<!-- placeholder to force blank line before included text --><!-- include: CustomGroupingExamples.test.dependencies_task.id_docs.approved.md -->
181+
182+
```javascript
183+
group by function task.id
184+
```
185+
186+
- Group by task Ids, if any.
187+
- Note that currently there is no way to access any tasks that are blocked by these Ids.
188+
189+
<!-- placeholder to force blank line after included text --><!-- endInclude -->
190+
180191
### Blocked By
181192

182193
There is no built-in instruction to group by 'Blocked By'.
@@ -189,6 +200,18 @@ For more information, see [[Task Dependencies]].
189200

190201
Since Tasks X.Y.Z, **[[Custom Grouping|custom grouping]] by Blocked By** is now possible, using `task.blockedBy`.
191202

203+
<!-- placeholder to force blank line before included text --><!-- include: CustomGroupingExamples.test.dependencies_task.blockedBy_docs.approved.md -->
204+
205+
```javascript
206+
group by function task.blockedBy
207+
```
208+
209+
- Group by the Ids of the tasks that this task depends on, if any.
210+
- If a task depends on more than one other task, it will be listed multiple times.
211+
- Note that currently there is no way to access the tasks being depended on.
212+
213+
<!-- placeholder to force blank line after included text --><!-- endInclude -->
214+
192215
## Group by Dates in Tasks
193216

194217
### Due Date
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- placeholder to force blank line before included text -->
2+
3+
4+
```javascript
5+
group by function task.blockedBy
6+
```
7+
8+
- Group by the Ids of the tasks that each task depends on, if any.
9+
- If a task depends on more than one other task, it will be listed multiple times.
10+
- Note that currently there is no way to access the tasks being depended on.
11+
12+
13+
<!-- placeholder to force blank line after included text -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Results of custom groupers
2+
3+
4+
5+
group by function task.blockedBy
6+
Group by the Ids of the tasks that each task depends on, if any.
7+
If a task depends on more than one other task, it will be listed multiple times.
8+
Note that currently there is no way to access the tasks being depended on.
9+
=>
10+
0h17ye
11+
dcf64c
12+
====================================================================================
13+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!-- placeholder to force blank line before included text -->
2+
3+
4+
```javascript
5+
group by function task.id
6+
```
7+
8+
- Group by task Ids, if any.
9+
- Note that currently there is no way to access any tasks that are blocked by these Ids.
10+
11+
12+
<!-- placeholder to force blank line after included text -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Results of custom groupers
2+
3+
4+
5+
group by function task.id
6+
Group by task Ids, if any.
7+
Note that currently there is no way to access any tasks that are blocked by these Ids.
8+
=>
9+
dcf64c
10+
====================================================================================
11+

tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,47 @@ afterEach(() => {
2626

2727
// NEW_QUERY_INSTRUCTION_EDIT_REQUIRED
2828

29+
describe('dependencies', () => {
30+
const testData: CustomPropertyDocsTestData[] = [
31+
// ---------------------------------------------------------------------------------
32+
// DEPENDENCIES FIELDS
33+
// ---------------------------------------------------------------------------------
34+
35+
[
36+
'task.id',
37+
[
38+
[
39+
'group by function task.id',
40+
'Group by task Ids, if any.',
41+
'Note that currently there is no way to access any tasks that are blocked by these Ids.',
42+
],
43+
],
44+
SampleTasks.withAllRepresentativeDependencyFields(),
45+
],
46+
47+
[
48+
'task.blockedBy',
49+
[
50+
[
51+
'group by function task.blockedBy',
52+
'Group by the Ids of the tasks that each task depends on, if any',
53+
'If a task depends on more than one other task, it will be listed multiple times.',
54+
'Note that currently there is no way to access the tasks being depended on',
55+
],
56+
],
57+
SampleTasks.withAllRepresentativeDependencyFields(),
58+
],
59+
];
60+
61+
it.each(testData)('%s results', (_: string, groups: QueryInstructionLineAndDescription[], tasks: Task[]) => {
62+
verifyFunctionFieldGrouperSamplesOnTasks(groups, tasks);
63+
});
64+
65+
it.each(testData)('%s docs', (_: string, groups: QueryInstructionLineAndDescription[], _tasks: Task[]) => {
66+
verifyFunctionFieldGrouperSamplesForDocs(groups);
67+
});
68+
});
69+
2970
describe('dates', () => {
3071
const testData: CustomPropertyDocsTestData[] = [
3172
// ---------------------------------------------------------------------------------

0 commit comments

Comments
 (0)