Skip to content

Commit 8f23367

Browse files
committed
refactor: teach createGrouper() to reverse
1 parent 42a61b6 commit 8f23367

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Query/Filter/Field.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ export abstract class Field {
280280
* For now, parsing of `group by` lines is currently done in {@link FilterParser.parseGrouper()}.
281281
* Later, this will probably be moved to the {@link Field} classes.
282282
*/
283-
public createGrouper(): Grouper {
284-
return new Grouper(this.fieldNameSingular(), this.grouper());
283+
public createGrouper(reverse: boolean = false): Grouper {
284+
return new Grouper(this.fieldNameSingular(), this.grouper(), reverse);
285285
}
286286

287287
/**

tests/TaskGroups.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import moment from 'moment';
55
import { FilenameField } from '../src/Query/Filter/FilenameField';
6-
import { Grouper } from '../src/Query/Grouper';
6+
import type { Grouper } from '../src/Query/Grouper';
77
import type { Task } from '../src/Task';
88
import { PathField } from '../src/Query/Filter/PathField';
99
import { TagsField } from '../src/Query/Filter/TagsField';
@@ -171,8 +171,7 @@ describe('Grouping tasks', () => {
171171
const inputs = [a, b];
172172

173173
// Act
174-
const dueDateField = new DueDateField();
175-
const grouping: Grouper[] = [new Grouper('due reverse', dueDateField.grouper(), true)];
174+
const grouping: Grouper[] = [new DueDateField().createGrouper(true)];
176175
const groups = new TaskGroups(grouping, inputs);
177176

178177
// Assert

0 commit comments

Comments
 (0)