@go-avro/avro-js 1.6.6-rc13 → 1.6.6-rc14

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.
@@ -50,7 +50,10 @@ export class Job {
50
50
  if (!this.tasks || this.tasks.length === 0) {
51
51
  return 0;
52
52
  }
53
- const routeJob = this.routes.find((r) => r.job_id === this.id);
53
+ // This route's stop: a job on several routes visits different tasks
54
+ // on each. Fall back to any stop if the route's isn't loaded.
55
+ const routeJob = this.routes.find((r) => r.job_id === this.id && r.route_id === route.id) ??
56
+ this.routes.find((r) => r.job_id === this.id);
54
57
  if (!routeJob) {
55
58
  return 0;
56
59
  }
@@ -185,7 +185,22 @@ export class Task {
185
185
  const routeDay = new Date((route.start_time ?? 0) * 1000);
186
186
  routeDay.setHours(0, 0, 0, 0);
187
187
  const cutoff = Math.floor(routeDay.getTime() / 1000);
188
- return (this.last_completed_event?.time_ended ?? 0) >= cutoff;
188
+ if ((this.last_completed_event?.time_ended ?? 0) >= cutoff)
189
+ return true;
190
+ // Not due this visit: a task repeating less often than its route
191
+ // (biweekly edging on a weekly route) that won't come due before the
192
+ // route's next visit needs nothing today. Without this, every
193
+ // off-week visit showed as half done however complete it was.
194
+ const nextDue = this.getNextDue();
195
+ if (nextDue == null)
196
+ return false;
197
+ const routeDayEnd = new Date(routeDay);
198
+ routeDayEnd.setDate(routeDayEnd.getDate() + 1);
199
+ const nextVisit = route.getNextOccurrence(routeDayEnd);
200
+ // One-off routes have no next visit: then only the route's day counts.
201
+ const horizon = nextVisit ? new Date(nextVisit) : routeDayEnd;
202
+ horizon.setHours(0, 0, 0, 0);
203
+ return nextDue >= Math.floor(horizon.getTime() / 1000);
189
204
  };
190
205
  assignData(this, init);
191
206
  // Payloads from the server carry no timestamp: they were computed
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AVRO_JS_VERSION = "1.6.6-rc13";
1
+ export declare const AVRO_JS_VERSION = "1.6.6-rc14";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.js — do not edit by hand.
2
2
  // Regenerated from package.json by the `prebuild` npm hook.
3
- export const AVRO_JS_VERSION = '1.6.6-rc13';
3
+ export const AVRO_JS_VERSION = '1.6.6-rc14';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "1.6.6-rc13",
3
+ "version": "1.6.6-rc14",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",