@golemio/pid 2.4.3-dev.771180443 → 2.4.3-dev.772251981
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/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/BusDelayAtStop.js +12 -11
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/BusDelayAtStop.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,26 +7,29 @@ const const_1 = require("../../../../../../../const");
|
|
|
7
7
|
const AbstractDelayAtStop_1 = __importDefault(require("./AbstractDelayAtStop"));
|
|
8
8
|
class BusDelayAtStop extends AbstractDelayAtStop_1.default {
|
|
9
9
|
updateContext(context, positionToUpdate, position) {
|
|
10
|
-
var _a, _b
|
|
10
|
+
var _a, _b;
|
|
11
11
|
if (!this.isTcpBus(position) || position.tracking !== const_1.PositionTrackingEnum.TRACKING) {
|
|
12
12
|
return context;
|
|
13
13
|
}
|
|
14
14
|
context = this.resetContext(context, positionToUpdate, position);
|
|
15
|
-
if (
|
|
16
|
-
context.lastPositionLastStop.sequence = (_b = (_a = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.
|
|
17
|
-
context.lastPositionLastStop.departure_delay = context.lastPositionDelay;
|
|
15
|
+
if (!context.lastPositionLastStop.sequence) {
|
|
16
|
+
context.lastPositionLastStop.sequence = (_b = (_a = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.last_stop_sequence) !== null && _a !== void 0 ? _a : position === null || position === void 0 ? void 0 : position.last_stop_sequence) !== null && _b !== void 0 ? _b : null;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
context.lastPositionLastStop.sequence = (_d = (_c = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.last_stop_sequence) !== null && _c !== void 0 ? _c : position.last_stop_sequence) !== null && _d !== void 0 ? _d : null;
|
|
18
|
+
if (this.didBusDepart(position)) {
|
|
21
19
|
context.lastPositionLastStop.departure_delay = context.lastPositionDelay;
|
|
22
20
|
}
|
|
23
21
|
return context;
|
|
24
22
|
}
|
|
25
23
|
updatePosition(context, positionToUpdate, position) {
|
|
24
|
+
var _a;
|
|
26
25
|
if (!this.isTcpBus(position) || position.tracking !== const_1.PositionTrackingEnum.TRACKING) {
|
|
27
26
|
return positionToUpdate;
|
|
28
27
|
}
|
|
29
|
-
|
|
28
|
+
context = this.resetContext(context, positionToUpdate, position);
|
|
29
|
+
if (this.didBusDepart(position) && positionToUpdate.state_position !== const_1.StatePositionEnum.AFTER_TRACK) {
|
|
30
|
+
positionToUpdate.delay_stop_departure = (_a = positionToUpdate.delay) !== null && _a !== void 0 ? _a : position.delay;
|
|
31
|
+
}
|
|
32
|
+
else if (context.lastPositionLastStop.departure_delay) {
|
|
30
33
|
positionToUpdate.delay_stop_departure = context.lastPositionLastStop.departure_delay;
|
|
31
34
|
}
|
|
32
35
|
return positionToUpdate;
|
|
@@ -34,10 +37,8 @@ class BusDelayAtStop extends AbstractDelayAtStop_1.default {
|
|
|
34
37
|
isTcpBus(position) {
|
|
35
38
|
return !!(position === null || position === void 0 ? void 0 : position.tcp_event);
|
|
36
39
|
}
|
|
37
|
-
didBusDepart(position
|
|
38
|
-
|
|
39
|
-
return (position.tcp_event === const_1.TCPEventEnum.DEPARTURED ||
|
|
40
|
-
context.lastPositionLastStop.sequence !== ((_a = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.last_stop_sequence) !== null && _a !== void 0 ? _a : position.last_stop_sequence));
|
|
40
|
+
didBusDepart(position) {
|
|
41
|
+
return position.tcp_event === const_1.TCPEventEnum.DEPARTURED;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
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,IAAI,QAAQ,CAAC,QAAQ,KAAK,4BAAoB,CAAC,QAAQ,EAAE;YACjF,OAAO,OAAO,CAAC;SAClB;QAED,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAEjE,IAAI,
|
|
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,IAAI,QAAQ,CAAC,QAAQ,KAAK,4BAAoB,CAAC,QAAQ,EAAE;YACjF,OAAO,OAAO,CAAC;SAClB;QAED,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAEjE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,EAAE;YACxC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,GAAG,MAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,kBAAkB,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,kBAAkB,mCAAI,IAAI,CAAC;SACxH;QAED,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;YAC7B,OAAO,C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