@golemio/pid 2.4.3-dev.770868318 → 2.4.3-dev.771089248
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 +11 -12
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/BusDelayAtStop.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,15 +7,17 @@ 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, _c, _d;
|
|
11
11
|
if (!this.isTcpBus(position)) {
|
|
12
12
|
return context;
|
|
13
13
|
}
|
|
14
14
|
context = this.resetContext(context, positionToUpdate, position);
|
|
15
|
-
if (
|
|
15
|
+
if ((positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.state_position) === const_1.StatePositionEnum.AT_STOP) {
|
|
16
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
|
+
context.lastPositionLastStop.departure_time = position.origin_timestamp;
|
|
17
18
|
}
|
|
18
|
-
if (this.didBusDepart(position
|
|
19
|
+
else if (this.didBusDepart(position)) {
|
|
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;
|
|
19
21
|
context.lastPositionLastStop.departure_time = position.origin_timestamp;
|
|
20
22
|
}
|
|
21
23
|
return context;
|
|
@@ -24,21 +26,18 @@ class BusDelayAtStop extends AbstractDelayAtStop_1.default {
|
|
|
24
26
|
if (!this.isTcpBus(position)) {
|
|
25
27
|
return positionToUpdate;
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
positionToUpdate.delay_stop_departure = this.calcDelayAtStop(
|
|
29
|
+
if (!positionToUpdate.delay_stop_departure &&
|
|
30
|
+
context.lastPositionLastStop.departure_time &&
|
|
31
|
+
positionToUpdate.last_stop_departure_time) {
|
|
32
|
+
positionToUpdate.delay_stop_departure = this.calcDelayAtStop(context.lastPositionLastStop.departure_time, positionToUpdate.last_stop_departure_time);
|
|
31
33
|
}
|
|
32
34
|
return positionToUpdate;
|
|
33
35
|
}
|
|
34
36
|
isTcpBus(position) {
|
|
35
37
|
return !!(position === null || position === void 0 ? void 0 : position.tcp_event);
|
|
36
38
|
}
|
|
37
|
-
didBusDepart(position
|
|
38
|
-
|
|
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);
|
|
39
|
+
didBusDepart(position) {
|
|
40
|
+
return position.tcp_event === const_1.TCPEventEnum.DEPARTURED && position.tracking === const_1.PositionTrackingEnum.TRACKING;
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
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;
|
|
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;QAEjE,IAAI,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,cAAc,MAAK,yBAAiB,CAAC,OAAO,EAAE;YAChE,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;aAAM,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;YACpC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,GAAG,MAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,kBAAkB,mCAAI,QAAQ,CAAC,kBAAkB,m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