@golemio/pid 2.4.3-dev.770868318 → 2.4.3-dev.770986763

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.
@@ -12,21 +12,22 @@ class BusDelayAtStop extends AbstractDelayAtStop_1.default {
12
12
  return context;
13
13
  }
14
14
  context = this.resetContext(context, positionToUpdate, position);
15
- if (position.state_position === const_1.StatePositionEnum.AT_STOP) {
16
- context.lastPositionLastStop.sequence = (_b = (_a = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.this_stop_sequence) !== null && _a !== void 0 ? _a : position.this_stop_sequence) !== null && _b !== void 0 ? _b : null;
17
- }
18
- if (this.didBusDepart(position, positionToUpdate, context)) {
15
+ if (this.didBusDepart(position)) {
16
+ context.lastPositionLastStop.sequence = (_b = (_a = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.last_stop_sequence) !== null && _a !== void 0 ? _a : position.last_stop_sequence) !== null && _b !== void 0 ? _b : null;
19
17
  context.lastPositionLastStop.departure_time = position.origin_timestamp;
20
18
  }
21
19
  return context;
22
20
  }
23
21
  updatePosition(context, positionToUpdate, position) {
22
+ var _a;
24
23
  if (!this.isTcpBus(position)) {
25
24
  return positionToUpdate;
26
25
  }
27
26
  context = this.resetContext(context, positionToUpdate, position);
28
27
  positionToUpdate = this.updatePositionBasedOnContext(context, positionToUpdate);
29
- if (this.didBusDepart(position, positionToUpdate, context) && !positionToUpdate.delay_stop_departure) {
28
+ if (this.didBusDepart(position) &&
29
+ context.lastPositionLastStop.sequence === ((_a = position.last_stop_sequence) !== null && _a !== void 0 ? _a : positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.last_stop_sequence) &&
30
+ !positionToUpdate.delay_stop_departure) {
30
31
  positionToUpdate.delay_stop_departure = this.calcDelayAtStop(position.origin_timestamp, positionToUpdate.last_stop_departure_time);
31
32
  }
32
33
  return positionToUpdate;
@@ -34,11 +35,8 @@ class BusDelayAtStop extends AbstractDelayAtStop_1.default {
34
35
  isTcpBus(position) {
35
36
  return !!(position === null || position === void 0 ? void 0 : position.tcp_event);
36
37
  }
37
- didBusDepart(position, positionToUpdate, context) {
38
- var _a;
39
- return (position.tcp_event === const_1.TCPEventEnum.DEPARTURED &&
40
- context.lastPositionLastStop.sequence === ((_a = position.last_stop_sequence) !== null && _a !== void 0 ? _a : positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.last_stop_sequence) &&
41
- position.tracking === const_1.PositionTrackingEnum.TRACKING);
38
+ didBusDepart(position) {
39
+ return position.tcp_event === const_1.TCPEventEnum.DEPARTURED && position.tracking === const_1.PositionTrackingEnum.TRACKING;
42
40
  }
43
41
  }
44
42
  exports.default = BusDelayAtStop;
@@ -1 +1 @@
1
- {"version":3,"file":"BusDelayAtStop.js","sourceRoot":"","sources":["../../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/BusDelayAtStop.ts"],"names":[],"mappings":";;;;;AAGA,sDAAkF;AAClF,gFAAwD;AAExD,MAAqB,cAAe,SAAQ,6BAAmB;IACpD,aAAa,CAChB,OAAoC,EACpC,gBAA0C,EAC1C,QAAoC;;QAEpC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC1B,OAAO,OAAO,CAAC;SAClB;QAED,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACjE,IAAI,QAAQ,CAAC,cAAc,KAAK,yBAAiB,CAAC,OAAO,EAAE;YACvD,OAAO,CAAC,oBAAoB,CAAC,QAAQ,GAAG,MAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,kBAAkB,mCAAI,QAAQ,CAAC,kBAAkB,mCAAI,IAAI,CAAC;SACvH;QAED,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,CAAC,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"file":"BusDelayAtStop.js","sourceRoot":"","sources":["../../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/BusDelayAtStop.ts"],"names":[],"mappings":";;;;;AAGA,sDAAkF;AAClF,gFAAwD;AAExD,MAAqB,cAAe,SAAQ,6BAAmB;IACpD,aAAa,CAChB,OAAoC,EACpC,gBAA0C,EAC1C,QAAoC;;QAEpC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC1B,OAAO,OAAO,CAAC;SAClB;QAED,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACjE,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;YAC7B,OAAO,CAAC,oBAAoB,CAAC,QAAQ,GAAG,MAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,kBAAkB,mCAAI,QAAQ,CAAC,kBAAkB,mCAAI,IAAI,CAAC;YACpH,OAAO,CAAC,oBAAoB,CAAC,cAAc,GAAG,QAAQ,CAAC,gBAAgB,CAAC;SAC3E;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,cAAc,CACjB,OAAoC,EACpC,gBAAmC,EACnC,QAAgD;;QAEhD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC1B,OAAO,gBAAgB,CAAC;SAC3B;QAED,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACjE,gBAAgB,GAAG,IAAI,CAAC,4BAA4B,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAEhF,IACI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;YAC3B,OAAO,CAAC,oBAAoB,CAAC,QAAQ,KAAK,CAAC,MAAA,QAAQ,CAAC,kBAAkB,mCAAI,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,kBAAkB,CAAC;YAC/G,CAAC,gBAAgB,CAAC,oBAAoB,EACxC;YACE,gBAAgB,CAAC,oBAAoB,GAAG,IAAI,CAAC,eAAe,CACxD,QAAQ,CAAC,gBAAgB,EACzB,gBAAgB,CAAC,wBAAyB,CAC7C,CAAC;SACL;QAED,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAEO,QAAQ,CAAC,QAAgD;QAC7D,OAAO,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAA,CAAC;IACjC,CAAC;IAEO,YAAY,CAAC,QAAoC;QACrD,OAAO,QAAQ,CAAC,SAAS,KAAK,oBAAY,CAAC,UAAU,IAAI,QAAQ,CAAC,QAAQ,KAAK,4BAAoB,CAAC,QAAQ,CAAC;IACjH,CAAC;CACJ;AApDD,iCAoDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.4.3-dev.770868318",
3
+ "version": "2.4.3-dev.770986763",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",