@go-avro/avro-js 0.0.4-beta.25 → 0.0.4-beta.26
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/api/Job.d.ts
CHANGED
|
@@ -31,6 +31,6 @@ declare module '../../types/api/Job' {
|
|
|
31
31
|
}
|
|
32
32
|
export declare class Job {
|
|
33
33
|
constructor(init?: Partial<Job>);
|
|
34
|
-
portionDone: (fallback
|
|
35
|
-
isDone: (fallback
|
|
34
|
+
portionDone: (fallback: Date | null) => number;
|
|
35
|
+
isDone: (fallback: Date | null) => boolean;
|
|
36
36
|
}
|
package/dist/types/api/Job.js
CHANGED
|
@@ -2,13 +2,13 @@ import { Task } from "../../types/api/Task";
|
|
|
2
2
|
import { RouteJob } from "../../types/api/RouteJob";
|
|
3
3
|
export class Job {
|
|
4
4
|
constructor(init) {
|
|
5
|
-
this.portionDone = (fallback
|
|
5
|
+
this.portionDone = (fallback) => {
|
|
6
6
|
if (!this.tasks || this.tasks.length === 0) {
|
|
7
7
|
return 0;
|
|
8
8
|
}
|
|
9
9
|
return this.tasks.filter(t => t.isDone?.(fallback)).length / this.tasks.length;
|
|
10
10
|
};
|
|
11
|
-
this.isDone = (fallback
|
|
11
|
+
this.isDone = (fallback) => {
|
|
12
12
|
return this.portionDone(fallback) === 1;
|
|
13
13
|
};
|
|
14
14
|
Object.assign(this, init);
|
package/dist/types/api/Task.d.ts
CHANGED
|
@@ -53,5 +53,5 @@ export declare class Task {
|
|
|
53
53
|
computeNextTaskState: (isCustomer: boolean, action: "accept" | "modify" | "reject") => TaskStatus;
|
|
54
54
|
getPrepaidEventsRemaining: () => number;
|
|
55
55
|
getPrepaidMonthsRemaining: () => number;
|
|
56
|
-
isDone: (fallback
|
|
56
|
+
isDone: (fallback: Date | null) => boolean | 1;
|
|
57
57
|
}
|
package/dist/types/api/Task.js
CHANGED
|
@@ -51,16 +51,19 @@ export class Task {
|
|
|
51
51
|
return acc;
|
|
52
52
|
}, 0);
|
|
53
53
|
};
|
|
54
|
-
this.isDone = (fallback
|
|
54
|
+
this.isDone = (fallback) => {
|
|
55
55
|
if (!this.status || this.status !== TaskStatus.ACTIVE) {
|
|
56
56
|
return 1;
|
|
57
57
|
}
|
|
58
58
|
if (this.frequency > 0) {
|
|
59
59
|
return this.overdue_time <= 0;
|
|
60
60
|
}
|
|
61
|
-
else {
|
|
61
|
+
else if (fallback) {
|
|
62
62
|
// If frequency is 0, use fallback
|
|
63
|
-
return new Date((this.last_completed_event?.time_ended ?? 0) * 1000) > (fallback
|
|
63
|
+
return new Date((this.last_completed_event?.time_ended ?? 0) * 1000) > (fallback);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return this.last_completed_event?.time_ended ? true : false;
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
Object.assign(this, init);
|