@outliant/sunrise-utils 1.1.23 → 1.1.25

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 CHANGED
@@ -4,9 +4,24 @@ 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.25](https://github.com/outliant/sunrise-utils/compare/1.1.24...1.1.25)
8
+
9
+ - chore: added project-pipeline criticalPathAge column #86azmbay5 [`5c9c9a2`](https://github.com/outliant/sunrise-utils/commit/5c9c9a216d926a2451216bbb1337d446ead9a93c)
10
+
11
+ #### [1.1.24](https://github.com/outliant/sunrise-utils/compare/1.1.23...1.1.24)
12
+
13
+ > 4 March 2024
14
+
15
+ - chore: fix task status filtering #86azhkzeb [`#32`](https://github.com/outliant/sunrise-utils/pull/32)
16
+ - chore: add due date sort script #86az9tt26 [`#33`](https://github.com/outliant/sunrise-utils/pull/33)
17
+ - chore(release): 1.1.24 [`5b7ee53`](https://github.com/outliant/sunrise-utils/commit/5b7ee53dfd5f96b2d268ba208491c27863249ced)
18
+
7
19
  #### [1.1.23](https://github.com/outliant/sunrise-utils/compare/1.1.22...1.1.23)
8
20
 
21
+ > 28 February 2024
22
+
9
23
  - chore: fix task pipeline last comment date filtering #86azcxk24 [`#29`](https://github.com/outliant/sunrise-utils/pull/29)
24
+ - chore(release): 1.1.23 [`b806236`](https://github.com/outliant/sunrise-utils/commit/b80623635b5eb5ddfe9566458fcb493de4daed7b)
10
25
 
11
26
  #### [1.1.22](https://github.com/outliant/sunrise-utils/compare/1.1.21...1.1.22)
12
27
 
@@ -27,6 +27,12 @@ module.exports.defaultCustomColumns = [
27
27
  type: 'criticalPathStage',
28
28
  field_type: 'select'
29
29
  },
30
+ {
31
+ name: 'Critical Path Age',
32
+ value: 'criticalPathAge',
33
+ type: 'criticalPathAge',
34
+ field_type: 'date'
35
+ },
30
36
  {
31
37
  name: 'Cancelled',
32
38
  value: 'on_hold',
@@ -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
  }
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outliant/sunrise-utils",
3
3
  "description": "Helper functions for project Sunrise",
4
- "version": "1.1.23",
4
+ "version": "1.1.25",
5
5
  "license": "ISC",
6
6
  "author": "Outliant",
7
7
  "main": "index.js",
@@ -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: [{ term: { is_ready: true } }, { term: { is_complete: false } }]
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: [{ term: { is_ready: true } }, { term: { is_complete: false } }]
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
- { term: { organization_id: { value: 'test-org' } } },
76
- { term: { department_id: { value: 'test-department' } } },
77
- { term: { project_id: { value: 'test-project' } } },
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
- { term: { is_ready: true } },
82
- { term: { is_complete: false } }
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
- { term: { on_hold: false } },
90
- { bool: { must_not: { exists: { field: 'on_hold' } } } }
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
  }