@outliant/sunrise-utils 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/helpers/projectFilter/index.js +6 -3
- package/helpers/projectFilter/isGeneratedFilter.js +43 -0
- package/helpers/projectFilter/isPausedFilter.js +43 -0
- package/helpers/projectFilter/onHoldFilter.js +45 -0
- package/helpers/projectFilter/projectFieldFilter.js +7 -18
- package/helpers/taskFilter/index.js +14 -4
- package/helpers/taskFilter/isPausedFilter.js +46 -8
- package/helpers/taskFilter/onHoldFilter.js +47 -5
- package/helpers/taskFilter/statusFilter.js +19 -5
- package/helpers/taskFilter/wasMarkedIncomplete.js +51 -0
- package/package.json +1 -1
- package/test/helpers/taskFilter/statusFilter.spec.js +22 -11
- package/test/lib/taskPipeline.spec.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [1.3.0](https://github.com/outliant/sunrise-utils/compare/1.2.5...1.3.0)
|
|
8
|
+
|
|
9
|
+
- chore: fix boolean columns [`17269be`](https://github.com/outliant/sunrise-utils/commit/17269be8df001b5f625a98a85fc045eb85d916ce)
|
|
10
|
+
|
|
11
|
+
#### [1.2.5](https://github.com/outliant/sunrise-utils/compare/1.2.4...1.2.5)
|
|
12
|
+
|
|
13
|
+
> 6 December 2024
|
|
14
|
+
|
|
15
|
+
- chore: added task archived status [`602a04a`](https://github.com/outliant/sunrise-utils/commit/602a04a95d8592c85237a74607e3acea130ec278)
|
|
16
|
+
- chore(release): 1.2.5 [`9172f49`](https://github.com/outliant/sunrise-utils/commit/9172f49da27b2a4c02d5c60acd02b3013433f3a0)
|
|
17
|
+
|
|
7
18
|
#### [1.2.4](https://github.com/outliant/sunrise-utils/compare/1.2.3...1.2.4)
|
|
8
19
|
|
|
20
|
+
> 8 October 2024
|
|
21
|
+
|
|
22
|
+
- chore(release): 1.2.4 [`d681a97`](https://github.com/outliant/sunrise-utils/commit/d681a970cf3363e1eec51a637c91a76f27e5bbca)
|
|
9
23
|
- chore: Rough DC Inspection banner [`6bbc072`](https://github.com/outliant/sunrise-utils/commit/6bbc07291cec53eb6061f022248f2924f86f02b9)
|
|
10
24
|
|
|
11
25
|
#### [1.2.3](https://github.com/outliant/sunrise-utils/compare/1.2.2...1.2.3)
|
|
@@ -42,7 +42,8 @@ module.exports.defaultCustomColumns = [
|
|
|
42
42
|
name: 'Cancelled',
|
|
43
43
|
value: 'on_hold',
|
|
44
44
|
type: 'on_hold',
|
|
45
|
-
field_type: '
|
|
45
|
+
field_type: 'boolean',
|
|
46
|
+
// Not used anymore
|
|
46
47
|
select_fields: ['on_hold']
|
|
47
48
|
},
|
|
48
49
|
{
|
|
@@ -51,7 +52,8 @@ module.exports.defaultCustomColumns = [
|
|
|
51
52
|
name: 'Is Paused',
|
|
52
53
|
value: 'is_paused',
|
|
53
54
|
type: 'is_paused',
|
|
54
|
-
field_type: '
|
|
55
|
+
field_type: 'boolean',
|
|
56
|
+
// Not used anymore
|
|
55
57
|
options: [
|
|
56
58
|
{
|
|
57
59
|
label: 'Yes',
|
|
@@ -68,7 +70,8 @@ module.exports.defaultCustomColumns = [
|
|
|
68
70
|
name: 'Is Generated',
|
|
69
71
|
value: 'is_generated',
|
|
70
72
|
type: 'is_generated',
|
|
71
|
-
field_type: '
|
|
73
|
+
field_type: 'boolean',
|
|
74
|
+
// Not used anymore
|
|
72
75
|
select_fields: ['is_generated']
|
|
73
76
|
},
|
|
74
77
|
{
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
module.exports = (filter) => {
|
|
2
2
|
switch (filter.condition) {
|
|
3
|
+
case 'is_true':
|
|
4
|
+
return module.exports.isTrue();
|
|
5
|
+
case 'is_false':
|
|
6
|
+
return module.exports.isFalse();
|
|
3
7
|
case 'is_equal':
|
|
4
8
|
return module.exports.isEqual();
|
|
5
9
|
case 'not_equal':
|
|
@@ -39,3 +43,42 @@ module.exports.isNotEqual = () => {
|
|
|
39
43
|
}
|
|
40
44
|
};
|
|
41
45
|
};
|
|
46
|
+
|
|
47
|
+
exports.isTrue = () => {
|
|
48
|
+
return {
|
|
49
|
+
bool: {
|
|
50
|
+
must: [
|
|
51
|
+
{
|
|
52
|
+
term: {
|
|
53
|
+
is_generated: {
|
|
54
|
+
value: true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
module.exports.isFalse = () => {
|
|
64
|
+
return {
|
|
65
|
+
bool: {
|
|
66
|
+
should: [
|
|
67
|
+
{
|
|
68
|
+
match: {
|
|
69
|
+
is_generated: false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
bool: {
|
|
74
|
+
must_not: {
|
|
75
|
+
exists: {
|
|
76
|
+
field: 'is_generated'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
module.exports = (filter) => {
|
|
2
2
|
switch (filter.condition) {
|
|
3
|
+
case 'is_true':
|
|
4
|
+
return module.exports.isTrue();
|
|
5
|
+
case 'is_false':
|
|
6
|
+
return module.exports.isFalse();
|
|
3
7
|
case 'is_equal':
|
|
4
8
|
return module.exports.isEqual();
|
|
5
9
|
case 'not_equal':
|
|
@@ -39,3 +43,42 @@ module.exports.isNotEqual = () => {
|
|
|
39
43
|
}
|
|
40
44
|
};
|
|
41
45
|
};
|
|
46
|
+
|
|
47
|
+
module.exports.isTrue = () => {
|
|
48
|
+
return {
|
|
49
|
+
bool: {
|
|
50
|
+
must: [
|
|
51
|
+
{
|
|
52
|
+
term: {
|
|
53
|
+
is_paused: {
|
|
54
|
+
value: true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
module.exports.isFalse = () => {
|
|
64
|
+
return {
|
|
65
|
+
bool: {
|
|
66
|
+
should: [
|
|
67
|
+
{
|
|
68
|
+
match: {
|
|
69
|
+
is_paused: false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
bool: {
|
|
74
|
+
must_not: {
|
|
75
|
+
exists: {
|
|
76
|
+
field: 'is_paused'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
module.exports = (filter) => {
|
|
2
2
|
switch (filter.condition) {
|
|
3
|
+
case 'is_true':
|
|
4
|
+
return module.exports.isTrue();
|
|
5
|
+
case 'is_false':
|
|
6
|
+
return module.exports.isFalse();
|
|
3
7
|
case 'is_equal':
|
|
4
8
|
return module.exports.isEqual();
|
|
5
9
|
case 'not_equal':
|
|
@@ -39,3 +43,44 @@ module.exports.isNotEqual = () => {
|
|
|
39
43
|
}
|
|
40
44
|
};
|
|
41
45
|
};
|
|
46
|
+
|
|
47
|
+
module.exports.isTrue = () => {
|
|
48
|
+
return {
|
|
49
|
+
bool: {
|
|
50
|
+
must: [
|
|
51
|
+
{
|
|
52
|
+
term: {
|
|
53
|
+
on_hold: {
|
|
54
|
+
value: true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
module.exports.isFalse = () => {
|
|
64
|
+
return {
|
|
65
|
+
bool: {
|
|
66
|
+
should: [
|
|
67
|
+
{
|
|
68
|
+
term: {
|
|
69
|
+
on_hold: {
|
|
70
|
+
value: false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
bool: {
|
|
76
|
+
must_not: {
|
|
77
|
+
exists: {
|
|
78
|
+
field: 'on_hold'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -46,10 +46,7 @@ module.exports = (filter) => {
|
|
|
46
46
|
case 'not_equal':
|
|
47
47
|
return module.exports.isNotEqual(filter);
|
|
48
48
|
case 'is_none_of':
|
|
49
|
-
return isNoneOf(
|
|
50
|
-
filter,
|
|
51
|
-
module.exports.isEqual
|
|
52
|
-
);
|
|
49
|
+
return isNoneOf(filter, module.exports.isEqual);
|
|
53
50
|
case 'before':
|
|
54
51
|
case 'less_than':
|
|
55
52
|
return module.exports.isBefore(filter);
|
|
@@ -514,12 +511,9 @@ module.exports.nextNDays = (filter) => {
|
|
|
514
511
|
return null;
|
|
515
512
|
}
|
|
516
513
|
|
|
517
|
-
const today = moment()
|
|
518
|
-
.startOf('day');
|
|
514
|
+
const today = moment().startOf('day');
|
|
519
515
|
|
|
520
|
-
const nextNDays = moment()
|
|
521
|
-
.add(filter.value, 'd')
|
|
522
|
-
.endOf('day');
|
|
516
|
+
const nextNDays = moment().add(filter.value, 'd').endOf('day');
|
|
523
517
|
|
|
524
518
|
const res = {
|
|
525
519
|
bool: {
|
|
@@ -566,12 +560,9 @@ module.exports.lastNDays = (filter) => {
|
|
|
566
560
|
return null;
|
|
567
561
|
}
|
|
568
562
|
|
|
569
|
-
const today = moment()
|
|
570
|
-
.startOf('day');
|
|
563
|
+
const today = moment().startOf('day');
|
|
571
564
|
|
|
572
|
-
const lastNDays = moment()
|
|
573
|
-
.subtract(filter.value, 'd')
|
|
574
|
-
.endOf('day');
|
|
565
|
+
const lastNDays = moment().subtract(filter.value, 'd').endOf('day');
|
|
575
566
|
|
|
576
567
|
const res = {
|
|
577
568
|
bool: {
|
|
@@ -617,9 +608,7 @@ module.exports.greaterNDaysAgo = (filter) => {
|
|
|
617
608
|
return null;
|
|
618
609
|
}
|
|
619
610
|
|
|
620
|
-
const greaterNDaysAgo = moment()
|
|
621
|
-
.subtract(filter.value, 'd')
|
|
622
|
-
.endOf('day');
|
|
611
|
+
const greaterNDaysAgo = moment().subtract(filter.value, 'd').endOf('day');
|
|
623
612
|
|
|
624
613
|
const res = {
|
|
625
614
|
bool: {
|
|
@@ -654,7 +643,7 @@ module.exports.greaterNDaysAgo = (filter) => {
|
|
|
654
643
|
};
|
|
655
644
|
|
|
656
645
|
return res;
|
|
657
|
-
}
|
|
646
|
+
};
|
|
658
647
|
|
|
659
648
|
module.exports.isBeforeIncludeParam = (filter) => {
|
|
660
649
|
if (!!filter.field_id) {
|
|
@@ -9,6 +9,7 @@ const buildIsPausedFilter = require('./isPausedFilter');
|
|
|
9
9
|
const buildIsStarredFilter = require('./isStarredFilter');
|
|
10
10
|
const buildDaysToCompleteFilter = require('./daysToComplete');
|
|
11
11
|
const buildAgeColorFilter = require('./buildAgeColorFilter');
|
|
12
|
+
const buildWasMarkedIncompleteFilter = require('./wasMarkedIncomplete');
|
|
12
13
|
const buildProjectFieldFilter = require('../projectFilter/projectFieldFilter');
|
|
13
14
|
const { PROJECT_BANNERS } = require('../../constants');
|
|
14
15
|
const splitString = require('../splitString');
|
|
@@ -39,6 +40,10 @@ module.exports.taskStatusOptions = [
|
|
|
39
40
|
validator && (validator.isCommercial() || validator.isService()),
|
|
40
41
|
label: 'Paused',
|
|
41
42
|
value: 'paused'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: 'Archived',
|
|
46
|
+
value: 'archived'
|
|
42
47
|
}
|
|
43
48
|
];
|
|
44
49
|
|
|
@@ -110,7 +115,7 @@ module.exports.defaultCustomColumns = [
|
|
|
110
115
|
type: 'status',
|
|
111
116
|
field_type: 'select',
|
|
112
117
|
options: [],
|
|
113
|
-
select_fields: ['is_complete', 'is_ready']
|
|
118
|
+
select_fields: ['is_complete', 'is_ready', 'deleted']
|
|
114
119
|
},
|
|
115
120
|
{
|
|
116
121
|
name: 'Region',
|
|
@@ -131,7 +136,8 @@ module.exports.defaultCustomColumns = [
|
|
|
131
136
|
name: 'Cancelled',
|
|
132
137
|
value: 'on_hold',
|
|
133
138
|
type: 'on_hold',
|
|
134
|
-
field_type: '
|
|
139
|
+
field_type: 'boolean',
|
|
140
|
+
// Not used anymore
|
|
135
141
|
options: [
|
|
136
142
|
{
|
|
137
143
|
label: 'Yes',
|
|
@@ -150,7 +156,8 @@ module.exports.defaultCustomColumns = [
|
|
|
150
156
|
name: 'Is Paused',
|
|
151
157
|
value: 'is_paused',
|
|
152
158
|
type: 'is_paused',
|
|
153
|
-
field_type: '
|
|
159
|
+
field_type: 'boolean',
|
|
160
|
+
// Not used anymore
|
|
154
161
|
options: [
|
|
155
162
|
{
|
|
156
163
|
label: 'Yes',
|
|
@@ -225,7 +232,8 @@ module.exports.defaultCustomColumns = [
|
|
|
225
232
|
name: 'Was Marked Incomplete',
|
|
226
233
|
value: 'was_marked_incomplete',
|
|
227
234
|
type: 'was_marked_incomplete',
|
|
228
|
-
field_type: '
|
|
235
|
+
field_type: 'boolean',
|
|
236
|
+
// Not used anymore
|
|
229
237
|
options: [
|
|
230
238
|
{
|
|
231
239
|
label: 'Yes',
|
|
@@ -323,6 +331,8 @@ module.exports.buildTaskPipelineFilter = (filter, starredTaskIds) => {
|
|
|
323
331
|
return buildOnHoldFilter(filter);
|
|
324
332
|
case 'is_paused':
|
|
325
333
|
return buildIsPausedFilter(filter);
|
|
334
|
+
case 'was_marked_incomplete':
|
|
335
|
+
return buildWasMarkedIncompleteFilter(filter);
|
|
326
336
|
case 'days_to_complete':
|
|
327
337
|
return buildDaysToCompleteFilter(filter);
|
|
328
338
|
// Always expected as is_equal condition
|
|
@@ -3,6 +3,10 @@ const { isNoneOf } = require('../common');
|
|
|
3
3
|
|
|
4
4
|
module.exports = (filter) => {
|
|
5
5
|
switch (filter.condition) {
|
|
6
|
+
case 'is_true':
|
|
7
|
+
return module.exports.isTrue();
|
|
8
|
+
case 'is_false':
|
|
9
|
+
return module.exports.isFalse();
|
|
6
10
|
case 'is_empty':
|
|
7
11
|
return module.exports.isEmpty();
|
|
8
12
|
case 'is_not_empty':
|
|
@@ -14,10 +18,7 @@ module.exports = (filter) => {
|
|
|
14
18
|
case 'is_any_of':
|
|
15
19
|
return module.exports.isAnyOf(filter); // if is any, means all tasks that have value
|
|
16
20
|
case 'is_none_of':
|
|
17
|
-
return isNoneOf(
|
|
18
|
-
filter,
|
|
19
|
-
module.exports.isEqual
|
|
20
|
-
);
|
|
21
|
+
return isNoneOf(filter, module.exports.isEqual);
|
|
21
22
|
default:
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
@@ -95,9 +96,7 @@ module.exports.isEqual = (filter) => {
|
|
|
95
96
|
module.exports.isNotEqual = (filter) => {
|
|
96
97
|
return {
|
|
97
98
|
bool: {
|
|
98
|
-
must_not: [
|
|
99
|
-
module.exports.isEqual(filter)
|
|
100
|
-
]
|
|
99
|
+
must_not: [module.exports.isEqual(filter)]
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
102
|
};
|
|
@@ -125,4 +124,43 @@ module.exports.isAnyOf = (filter) => {
|
|
|
125
124
|
should
|
|
126
125
|
}
|
|
127
126
|
};
|
|
128
|
-
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
module.exports.isTrue = () => {
|
|
130
|
+
return {
|
|
131
|
+
bool: {
|
|
132
|
+
must: [
|
|
133
|
+
{
|
|
134
|
+
term: {
|
|
135
|
+
is_paused: {
|
|
136
|
+
value: true
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
module.exports.isFalse = () => {
|
|
146
|
+
return {
|
|
147
|
+
bool: {
|
|
148
|
+
should: [
|
|
149
|
+
{
|
|
150
|
+
match: {
|
|
151
|
+
is_paused: false
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
bool: {
|
|
156
|
+
must_not: {
|
|
157
|
+
exists: {
|
|
158
|
+
field: 'is_paused'
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
};
|
|
@@ -3,6 +3,10 @@ const { isNoneOf } = require('../common');
|
|
|
3
3
|
|
|
4
4
|
module.exports = (filter) => {
|
|
5
5
|
switch (filter.condition) {
|
|
6
|
+
case 'is_true':
|
|
7
|
+
return module.exports.isTrue();
|
|
8
|
+
case 'is_false':
|
|
9
|
+
return module.exports.isFalse();
|
|
6
10
|
case 'is_empty':
|
|
7
11
|
return module.exports.isEmpty();
|
|
8
12
|
case 'is_not_empty':
|
|
@@ -14,10 +18,7 @@ module.exports = (filter) => {
|
|
|
14
18
|
case 'is_any_of':
|
|
15
19
|
return module.exports.isAnyOf(filter); // if is any, means all tasks that have value
|
|
16
20
|
case 'is_none_of':
|
|
17
|
-
return isNoneOf(
|
|
18
|
-
filter,
|
|
19
|
-
module.exports.isEqual
|
|
20
|
-
);
|
|
21
|
+
return isNoneOf(filter, module.exports.isEqual);
|
|
21
22
|
default:
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
@@ -106,4 +107,45 @@ module.exports.isAnyOf = (filter) => {
|
|
|
106
107
|
should
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
|
-
};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
module.exports.isTrue = () => {
|
|
113
|
+
return {
|
|
114
|
+
bool: {
|
|
115
|
+
must: [
|
|
116
|
+
{
|
|
117
|
+
term: {
|
|
118
|
+
on_hold: {
|
|
119
|
+
value: true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
module.exports.isFalse = () => {
|
|
129
|
+
return {
|
|
130
|
+
bool: {
|
|
131
|
+
should: [
|
|
132
|
+
{
|
|
133
|
+
term: {
|
|
134
|
+
on_hold: {
|
|
135
|
+
value: false
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
bool: {
|
|
141
|
+
must_not: {
|
|
142
|
+
exists: {
|
|
143
|
+
field: 'on_hold'
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
};
|
|
@@ -14,10 +14,7 @@ module.exports = (filter) => {
|
|
|
14
14
|
case 'is_any_of':
|
|
15
15
|
return module.exports.isAnyOf(filter);
|
|
16
16
|
case 'is_none_of':
|
|
17
|
-
return isNoneOf(
|
|
18
|
-
filter,
|
|
19
|
-
module.exports.isEqual
|
|
20
|
-
);
|
|
17
|
+
return isNoneOf(filter, module.exports.isEqual);
|
|
21
18
|
default:
|
|
22
19
|
return null;
|
|
23
20
|
}
|
|
@@ -41,6 +38,11 @@ module.exports.isEmpty = () => {
|
|
|
41
38
|
exists: {
|
|
42
39
|
field: 'on_hold'
|
|
43
40
|
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
exists: {
|
|
44
|
+
field: 'deleted'
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
]
|
|
46
48
|
}
|
|
@@ -173,6 +175,18 @@ module.exports.isEqual = (filter) => {
|
|
|
173
175
|
]
|
|
174
176
|
}
|
|
175
177
|
};
|
|
178
|
+
case 'archived':
|
|
179
|
+
return {
|
|
180
|
+
bool: {
|
|
181
|
+
must: [
|
|
182
|
+
{
|
|
183
|
+
term: {
|
|
184
|
+
deleted: true
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
};
|
|
176
190
|
default:
|
|
177
191
|
return null;
|
|
178
192
|
}
|
|
@@ -214,4 +228,4 @@ module.exports.isNotEqual = (filter) => {
|
|
|
214
228
|
}
|
|
215
229
|
|
|
216
230
|
return null;
|
|
217
|
-
};
|
|
231
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module.exports = (filter) => {
|
|
2
|
+
switch (filter.condition) {
|
|
3
|
+
case 'is_true':
|
|
4
|
+
return module.exports.isTrue();
|
|
5
|
+
case 'is_false':
|
|
6
|
+
return module.exports.isFalse();
|
|
7
|
+
default:
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports.isTrue = () => {
|
|
13
|
+
return {
|
|
14
|
+
bool: {
|
|
15
|
+
must: [
|
|
16
|
+
{
|
|
17
|
+
term: {
|
|
18
|
+
was_marked_incomplete: {
|
|
19
|
+
value: true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports.isFalse = () => {
|
|
29
|
+
return {
|
|
30
|
+
bool: {
|
|
31
|
+
should: [
|
|
32
|
+
{
|
|
33
|
+
term: {
|
|
34
|
+
was_marked_incomplete: {
|
|
35
|
+
value: false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
bool: {
|
|
41
|
+
must_not: {
|
|
42
|
+
exists: {
|
|
43
|
+
field: 'was_marked_incomplete'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
package/package.json
CHANGED
|
@@ -96,9 +96,7 @@ describe('taskFilter/statusFilter', function () {
|
|
|
96
96
|
},
|
|
97
97
|
output: {
|
|
98
98
|
bool: {
|
|
99
|
-
must: [
|
|
100
|
-
{ term: { is_paused: true } }
|
|
101
|
-
]
|
|
99
|
+
must: [{ term: { is_paused: true } }]
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
},
|
|
@@ -128,6 +126,21 @@ describe('taskFilter/statusFilter', function () {
|
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
128
|
},
|
|
129
|
+
{
|
|
130
|
+
input: {
|
|
131
|
+
condition: 'is_equal',
|
|
132
|
+
field_id: '',
|
|
133
|
+
type: 'status',
|
|
134
|
+
field_type: 'select',
|
|
135
|
+
value: 'archived',
|
|
136
|
+
second_value: ''
|
|
137
|
+
},
|
|
138
|
+
output: {
|
|
139
|
+
bool: {
|
|
140
|
+
must: [{ term: { deleted: true } }]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
131
144
|
{
|
|
132
145
|
input: {
|
|
133
146
|
condition: 'is_empty',
|
|
@@ -142,7 +155,8 @@ describe('taskFilter/statusFilter', function () {
|
|
|
142
155
|
must_not: [
|
|
143
156
|
{ exists: { field: 'is_complete' } },
|
|
144
157
|
{ exists: { field: 'is_ready' } },
|
|
145
|
-
{ exists: { field: 'on_hold' } }
|
|
158
|
+
{ exists: { field: 'on_hold' } },
|
|
159
|
+
{ exists: { field: 'deleted' } }
|
|
146
160
|
]
|
|
147
161
|
}
|
|
148
162
|
}
|
|
@@ -163,7 +177,8 @@ describe('taskFilter/statusFilter', function () {
|
|
|
163
177
|
must_not: [
|
|
164
178
|
{ exists: { field: 'is_complete' } },
|
|
165
179
|
{ exists: { field: 'is_ready' } },
|
|
166
|
-
{ exists: { field: 'on_hold' } }
|
|
180
|
+
{ exists: { field: 'on_hold' } },
|
|
181
|
+
{ exists: { field: 'deleted' } }
|
|
167
182
|
]
|
|
168
183
|
}
|
|
169
184
|
}
|
|
@@ -281,9 +296,7 @@ describe('taskFilter/statusFilter', function () {
|
|
|
281
296
|
},
|
|
282
297
|
{
|
|
283
298
|
bool: {
|
|
284
|
-
must: [
|
|
285
|
-
{ term: { on_hold: true } }
|
|
286
|
-
]
|
|
299
|
+
must: [{ term: { on_hold: true } }]
|
|
287
300
|
}
|
|
288
301
|
}
|
|
289
302
|
]
|
|
@@ -312,9 +325,7 @@ describe('taskFilter/statusFilter', function () {
|
|
|
312
325
|
},
|
|
313
326
|
{
|
|
314
327
|
bool: {
|
|
315
|
-
must: [
|
|
316
|
-
{ term: { on_hold: true } }
|
|
317
|
-
]
|
|
328
|
+
must: [{ term: { on_hold: true } }]
|
|
318
329
|
}
|
|
319
330
|
}
|
|
320
331
|
]
|