@outliant/sunrise-utils 1.1.28 → 1.1.29
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,10 +4,18 @@ 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.29](https://github.com/outliant/sunrise-utils/compare/1.1.28...1.1.29)
|
|
8
|
+
|
|
9
|
+
- chore: fix task field date filter #86b0j0q70 [`#38`](https://github.com/outliant/sunrise-utils/pull/38)
|
|
10
|
+
- chore: update task field date filter #86b0j0q70 [`3e806ba`](https://github.com/outliant/sunrise-utils/commit/3e806bac4a3144a9aa77ade67f980e6b583759c2)
|
|
11
|
+
|
|
7
12
|
#### [1.1.28](https://github.com/outliant/sunrise-utils/compare/1.1.27...1.1.28)
|
|
8
13
|
|
|
14
|
+
> 4 April 2024
|
|
15
|
+
|
|
9
16
|
- task starred column #86azquc2z [`#36`](https://github.com/outliant/sunrise-utils/pull/36)
|
|
10
17
|
- banners name and options update #85ztcymgr [`#37`](https://github.com/outliant/sunrise-utils/pull/37)
|
|
18
|
+
- chore(release): 1.1.28 [`980137b`](https://github.com/outliant/sunrise-utils/commit/980137bef447c8c0fac3b9a116bc72c972bc13fd)
|
|
11
19
|
- starredTaskIds parameter default value [`d1f69b5`](https://github.com/outliant/sunrise-utils/commit/d1f69b59611dc6b31d7c68a43e18b2920ea46c27)
|
|
12
20
|
|
|
13
21
|
#### [1.1.27](https://github.com/outliant/sunrise-utils/compare/1.1.26...1.1.27)
|
|
@@ -16,6 +16,9 @@ module.exports = (filter) => {
|
|
|
16
16
|
case 'is_not_empty':
|
|
17
17
|
return module.exports.isNotEmpty(filter);
|
|
18
18
|
case 'is_equal':
|
|
19
|
+
if (filter.type === 'ready_at') {
|
|
20
|
+
return module.exports.isReadyAt(filter);
|
|
21
|
+
}
|
|
19
22
|
return module.exports.isEqual(filter);
|
|
20
23
|
case 'not_equal':
|
|
21
24
|
return module.exports.isNotEqual(filter);
|
|
@@ -297,6 +300,51 @@ module.exports.isEqual = (filter) => {
|
|
|
297
300
|
};
|
|
298
301
|
};
|
|
299
302
|
|
|
303
|
+
module.exports.isReadyAt = (filter) => {
|
|
304
|
+
const startOfDay = moment(filter.value).startOf('day').valueOf();
|
|
305
|
+
const endOfDay = moment(filter.value).endOf('day').valueOf();
|
|
306
|
+
|
|
307
|
+
return {
|
|
308
|
+
script: {
|
|
309
|
+
script: {
|
|
310
|
+
source: `
|
|
311
|
+
try {
|
|
312
|
+
def filterType = params.filterType;
|
|
313
|
+
def taskFilter = doc[filterType];
|
|
314
|
+
|
|
315
|
+
if (taskFilter.size() == 0) {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
long startOfDay = params.startOfDay;
|
|
320
|
+
long endOfDay = params.endOfDay;
|
|
321
|
+
|
|
322
|
+
if (
|
|
323
|
+
filterType == 'ready_at' &&
|
|
324
|
+
doc['is_complete'].size() != 0 &&
|
|
325
|
+
doc['is_complete'].value == true &&
|
|
326
|
+
doc['completed_at'].size() != 0
|
|
327
|
+
) {
|
|
328
|
+
long completedAt = doc['completed_at'].value.millis;
|
|
329
|
+
return completedAt >= startOfDay && completedAt <= endOfDay;
|
|
330
|
+
} else {
|
|
331
|
+
long taskFilterValue = taskFilter.value.millis;
|
|
332
|
+
return taskFilterValue >= startOfDay && taskFilterValue <= endOfDay;
|
|
333
|
+
}
|
|
334
|
+
} catch(Exception err){
|
|
335
|
+
return false;
|
|
336
|
+
}`,
|
|
337
|
+
lang: 'painless',
|
|
338
|
+
params: {
|
|
339
|
+
startOfDay,
|
|
340
|
+
endOfDay,
|
|
341
|
+
filterType: filter.type
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
|
|
300
348
|
module.exports.isBefore = (filter) => {
|
|
301
349
|
let param;
|
|
302
350
|
|
package/package.json
CHANGED
|
@@ -435,6 +435,29 @@ describe('taskFieldFilter', function () {
|
|
|
435
435
|
second_value: ''
|
|
436
436
|
},
|
|
437
437
|
output: null
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
input: {
|
|
441
|
+
condition: 'is_equal',
|
|
442
|
+
field_id: '',
|
|
443
|
+
type: 'ready_at',
|
|
444
|
+
field_type: 'date',
|
|
445
|
+
value: 1675296000000,
|
|
446
|
+
second_value: ''
|
|
447
|
+
},
|
|
448
|
+
output: {
|
|
449
|
+
script:{
|
|
450
|
+
script: {
|
|
451
|
+
source: "\n try {\n def filterType = params.filterType;\n def taskFilter = doc[filterType];\n\n if (taskFilter.size() == 0) {\n return false;\n }\n\n long startOfDay = params.startOfDay;\n long endOfDay = params.endOfDay;\n\n if (\n filterType == 'ready_at' &&\n doc['is_complete'].size() != 0 &&\n doc['is_complete'].value == true &&\n doc['completed_at'].size() != 0\n ) {\n long completedAt = doc['completed_at'].value.millis;\n return completedAt >= startOfDay && completedAt <= endOfDay;\n } else {\n long taskFilterValue = taskFilter.value.millis;\n return taskFilterValue >= startOfDay && taskFilterValue <= endOfDay;\n }\n } catch(Exception err){\n return false;\n }",
|
|
452
|
+
lang: 'painless',
|
|
453
|
+
params: {
|
|
454
|
+
startOfDay: 1675267200000,
|
|
455
|
+
endOfDay: 1675353599999,
|
|
456
|
+
filterType: 'ready_at'
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
438
461
|
}
|
|
439
462
|
];
|
|
440
463
|
|