@naturalcycles/abba 1.13.0 → 1.13.1
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/dist/types.d.ts +3 -3
- package/dist/util.js +1 -1
- package/package.json +1 -1
- package/src/types.ts +3 -3
- package/src/util.ts +5 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommonDB } from '@naturalcycles/db-lib';
|
|
2
|
-
import { BaseDBEntity,
|
|
2
|
+
import { BaseDBEntity, Saved } from '@naturalcycles/js-lib';
|
|
3
3
|
export interface AbbaConfig {
|
|
4
4
|
db: CommonDB;
|
|
5
5
|
}
|
|
@@ -8,8 +8,8 @@ export type BaseExperiment = BaseDBEntity<number> & {
|
|
|
8
8
|
status: number;
|
|
9
9
|
sampling: number;
|
|
10
10
|
description: string | null;
|
|
11
|
-
startDateIncl:
|
|
12
|
-
endDateExcl:
|
|
11
|
+
startDateIncl: Date;
|
|
12
|
+
endDateExcl: Date;
|
|
13
13
|
};
|
|
14
14
|
export type Experiment = BaseExperiment & {
|
|
15
15
|
rules: SegmentationRule[];
|
package/dist/util.js
CHANGED
|
@@ -99,6 +99,6 @@ exports.validateSegmentationRule = validateSegmentationRule;
|
|
|
99
99
|
*/
|
|
100
100
|
const canGenerateNewAssignments = (experiment) => {
|
|
101
101
|
return (experiment.status === types_1.AssignmentStatus.Active &&
|
|
102
|
-
(0, js_lib_1.localDate)().isBetween(experiment.startDateIncl, experiment.endDateExcl, '[)'));
|
|
102
|
+
(0, js_lib_1.localDate)().isBetween((0, js_lib_1.localDate)(experiment.startDateIncl.toISOString()), (0, js_lib_1.localDate)(experiment.endDateExcl.toISOString()), '[)'));
|
|
103
103
|
};
|
|
104
104
|
exports.canGenerateNewAssignments = canGenerateNewAssignments;
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommonDB } from '@naturalcycles/db-lib'
|
|
2
|
-
import { BaseDBEntity,
|
|
2
|
+
import { BaseDBEntity, Saved } from '@naturalcycles/js-lib'
|
|
3
3
|
|
|
4
4
|
export interface AbbaConfig {
|
|
5
5
|
db: CommonDB
|
|
@@ -18,8 +18,8 @@ export type BaseExperiment = BaseDBEntity<number> & {
|
|
|
18
18
|
status: number
|
|
19
19
|
sampling: number
|
|
20
20
|
description: string | null
|
|
21
|
-
startDateIncl:
|
|
22
|
-
endDateExcl:
|
|
21
|
+
startDateIncl: Date
|
|
22
|
+
endDateExcl: Date
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export type Experiment = BaseExperiment & {
|
package/src/util.ts
CHANGED
|
@@ -102,6 +102,10 @@ export const validateSegmentationRule = (
|
|
|
102
102
|
export const canGenerateNewAssignments = (experiment: Experiment): boolean => {
|
|
103
103
|
return (
|
|
104
104
|
experiment.status === AssignmentStatus.Active &&
|
|
105
|
-
localDate().isBetween(
|
|
105
|
+
localDate().isBetween(
|
|
106
|
+
localDate(experiment.startDateIncl.toISOString()),
|
|
107
|
+
localDate(experiment.endDateExcl.toISOString()),
|
|
108
|
+
'[)',
|
|
109
|
+
)
|
|
106
110
|
)
|
|
107
111
|
}
|