@outliant/sunrise-utils 1.1.23 → 1.1.24
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 +8 -0
- package/helpers/sortScript.js +19 -0
- package/helpers/taskFilter/statusFilter.js +20 -0
- package/lib/taskPipeline.js +4 -0
- package/package.json +1 -1
- package/test/helpers/sortScript.spec.js +34 -0
- package/test/helpers/taskFilter/index.spec.js +32 -1
- package/test/helpers/taskFilter/statusFilter.spec.js +32 -1
- package/test/lib/taskPipeline.spec.js +65 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,17 @@ 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.1.24](https://github.com/outliant/sunrise-utils/compare/1.1.23...1.1.24)
|
|
8
|
+
|
|
9
|
+
- chore: fix task status filtering #86azhkzeb [`#32`](https://github.com/outliant/sunrise-utils/pull/32)
|
|
10
|
+
- chore: add due date sort script #86az9tt26 [`#33`](https://github.com/outliant/sunrise-utils/pull/33)
|
|
11
|
+
|
|
7
12
|
#### [1.1.23](https://github.com/outliant/sunrise-utils/compare/1.1.22...1.1.23)
|
|
8
13
|
|
|
14
|
+
> 28 February 2024
|
|
15
|
+
|
|
9
16
|
- chore: fix task pipeline last comment date filtering #86azcxk24 [`#29`](https://github.com/outliant/sunrise-utils/pull/29)
|
|
17
|
+
- chore(release): 1.1.23 [`b806236`](https://github.com/outliant/sunrise-utils/commit/b80623635b5eb5ddfe9566458fcb493de4daed7b)
|
|
10
18
|
|
|
11
19
|
#### [1.1.22](https://github.com/outliant/sunrise-utils/compare/1.1.21...1.1.22)
|
|
12
20
|
|
package/helpers/sortScript.js
CHANGED
|
@@ -284,6 +284,25 @@ module.exports.readyAt = (order) => {
|
|
|
284
284
|
};
|
|
285
285
|
};
|
|
286
286
|
|
|
287
|
+
module.exports.dueDate = (order) => {
|
|
288
|
+
return {
|
|
289
|
+
_script: {
|
|
290
|
+
type: 'number',
|
|
291
|
+
script: {
|
|
292
|
+
lang: 'painless',
|
|
293
|
+
source: `
|
|
294
|
+
if (!doc['due_date'].empty) {
|
|
295
|
+
return doc['due_date'].value.millis;
|
|
296
|
+
} else {
|
|
297
|
+
return -999999;
|
|
298
|
+
}
|
|
299
|
+
`
|
|
300
|
+
},
|
|
301
|
+
order
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
|
|
287
306
|
module.exports.wasMarkedIncomplete = (order) => {
|
|
288
307
|
return {
|
|
289
308
|
_script: {
|
|
@@ -89,6 +89,26 @@ module.exports.isEqual = (filter) => {
|
|
|
89
89
|
term: {
|
|
90
90
|
is_complete: false
|
|
91
91
|
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
bool: {
|
|
95
|
+
should: [
|
|
96
|
+
{
|
|
97
|
+
term: {
|
|
98
|
+
is_paused: false
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
bool: {
|
|
103
|
+
must_not: {
|
|
104
|
+
exists: {
|
|
105
|
+
field: 'is_paused'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
92
112
|
}
|
|
93
113
|
]
|
|
94
114
|
}
|
package/lib/taskPipeline.js
CHANGED
|
@@ -149,6 +149,10 @@ class TaskPipeline {
|
|
|
149
149
|
taskPipelinesSort.push(sortScript.lastCommentDate(sort));
|
|
150
150
|
break;
|
|
151
151
|
|
|
152
|
+
case s === 'due_date':
|
|
153
|
+
taskPipelinesSort.push(sortScript.dueDate(sort));
|
|
154
|
+
break;
|
|
155
|
+
|
|
152
156
|
case isUuid(s):
|
|
153
157
|
taskPipelinesSort.push(sortScript.projectFieldNumeric(sort, s));
|
|
154
158
|
taskPipelinesSort.push(sortScript.projectFieldText(sort, s));
|
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-env node, mocha */
|
|
4
|
+
const { expect } = require('chai');
|
|
5
|
+
|
|
6
|
+
// To test
|
|
7
|
+
const sortScript = require('../../helpers/sortScript');
|
|
8
|
+
|
|
9
|
+
describe('sortScript', function () {
|
|
10
|
+
describe('dueDate', function () {
|
|
11
|
+
const orders = ['desc', 'asc'];
|
|
12
|
+
for (const order of orders) {
|
|
13
|
+
it(`should handle \`${order}\` sort order`, () => {
|
|
14
|
+
const sort = sortScript.dueDate(order);
|
|
15
|
+
expect(sort).to.be.deep.equal({
|
|
16
|
+
_script: {
|
|
17
|
+
type: 'number',
|
|
18
|
+
script: {
|
|
19
|
+
lang: 'painless',
|
|
20
|
+
source: '\n' +
|
|
21
|
+
" if (!doc['due_date'].empty) {\n" +
|
|
22
|
+
" return doc['due_date'].value.millis;\n" +
|
|
23
|
+
' } else {\n' +
|
|
24
|
+
' return -999999;\n' +
|
|
25
|
+
' }\n' +
|
|
26
|
+
' '
|
|
27
|
+
},
|
|
28
|
+
order
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -19,7 +19,38 @@ describe('taskFilter', function () {
|
|
|
19
19
|
});
|
|
20
20
|
expect(filter).to.be.deep.equal({
|
|
21
21
|
bool: {
|
|
22
|
-
must: [
|
|
22
|
+
must: [
|
|
23
|
+
{
|
|
24
|
+
term: {
|
|
25
|
+
is_ready: true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
term: {
|
|
30
|
+
is_complete: false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
bool: {
|
|
35
|
+
should: [
|
|
36
|
+
{
|
|
37
|
+
term: {
|
|
38
|
+
is_paused: false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
bool: {
|
|
43
|
+
must_not: {
|
|
44
|
+
exists: {
|
|
45
|
+
field: 'is_paused'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
23
54
|
}
|
|
24
55
|
});
|
|
25
56
|
done();
|
|
@@ -31,7 +31,38 @@ describe('taskFilter/statusFilter', function () {
|
|
|
31
31
|
},
|
|
32
32
|
output: {
|
|
33
33
|
bool: {
|
|
34
|
-
must: [
|
|
34
|
+
must: [
|
|
35
|
+
{
|
|
36
|
+
term: {
|
|
37
|
+
is_ready: true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
term: {
|
|
42
|
+
is_complete: false
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
bool: {
|
|
47
|
+
should: [
|
|
48
|
+
{
|
|
49
|
+
term: {
|
|
50
|
+
is_paused: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
bool: {
|
|
55
|
+
must_not: {
|
|
56
|
+
exists: {
|
|
57
|
+
field: 'is_paused'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
35
66
|
}
|
|
36
67
|
}
|
|
37
68
|
},
|
|
@@ -72,22 +72,80 @@ describe('taskPipeline', function () {
|
|
|
72
72
|
expect(filter).to.deep.equal({
|
|
73
73
|
bool: {
|
|
74
74
|
must: [
|
|
75
|
-
{
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
{
|
|
76
|
+
term: {
|
|
77
|
+
organization_id: {
|
|
78
|
+
value: 'test-org'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
term: {
|
|
84
|
+
department_id: {
|
|
85
|
+
value: 'test-department'
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
term: {
|
|
91
|
+
project_id: {
|
|
92
|
+
value: 'test-project'
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
78
96
|
{
|
|
79
97
|
bool: {
|
|
80
98
|
must: [
|
|
81
|
-
{
|
|
82
|
-
|
|
99
|
+
{
|
|
100
|
+
term: {
|
|
101
|
+
is_ready: true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
term: {
|
|
106
|
+
is_complete: false
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
bool: {
|
|
111
|
+
should: [
|
|
112
|
+
{
|
|
113
|
+
term: {
|
|
114
|
+
is_paused: false
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
bool: {
|
|
119
|
+
must_not: {
|
|
120
|
+
exists: {
|
|
121
|
+
field: 'is_paused'
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
83
129
|
]
|
|
84
130
|
}
|
|
85
131
|
},
|
|
86
132
|
{
|
|
87
133
|
bool: {
|
|
88
134
|
should: [
|
|
89
|
-
{
|
|
90
|
-
|
|
135
|
+
{
|
|
136
|
+
term: {
|
|
137
|
+
on_hold: false
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
bool: {
|
|
142
|
+
must_not: {
|
|
143
|
+
exists: {
|
|
144
|
+
field: 'on_hold'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
91
149
|
]
|
|
92
150
|
}
|
|
93
151
|
}
|