@golemio/pid 2.2.12-dev.638356325 → 2.2.12-dev.638579279
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/helpers/compute-positions/strategy/AbstractDelayAtStop.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.js +3 -2
- package/dist/integration-engine/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/helpers/compute-positions/strategy/BusDelayAtStop.js +4 -4
- package/dist/integration-engine/vehicle-positions/helpers/compute-positions/strategy/BusDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/helpers/compute-positions/strategy/TramDelayAtStop.js +3 -2
- package/dist/integration-engine/vehicle-positions/helpers/compute-positions/strategy/TramDelayAtStop.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,6 @@ export default abstract class AbstractDelayAtStop {
|
|
|
4
4
|
abstract updateContext(context: IPositionsContext, positionToUpdate: IPositionToUpdate, position: ITripPositionAttributes): IPositionsContext;
|
|
5
5
|
abstract updatePosition(context: IPositionsContext, positionToUpdate: IPositionToUpdate, position: ITripPositionAttributes): IPositionToUpdate;
|
|
6
6
|
protected calcDelayAtStop(actualTimestamp: number | string, scheduledTimstamp: number): number;
|
|
7
|
-
protected resetContext(context: IPositionsContext, positionToUpdate: IPositionToUpdate): IPositionsContext;
|
|
7
|
+
protected resetContext(context: IPositionsContext, positionToUpdate: IPositionToUpdate, position: ITripPositionAttributes | undefined): IPositionsContext;
|
|
8
8
|
protected updatePositionBasedOnContext(context: IPositionsContext, positionToUpdate: IPositionToUpdate): IPositionToUpdate;
|
|
9
9
|
}
|
|
@@ -5,8 +5,9 @@ class AbstractDelayAtStop {
|
|
|
5
5
|
calcDelayAtStop(actualTimestamp, scheduledTimstamp) {
|
|
6
6
|
return (new Date(actualTimestamp).valueOf() - new Date(scheduledTimstamp).valueOf()) / 1000;
|
|
7
7
|
}
|
|
8
|
-
resetContext(context, positionToUpdate) {
|
|
9
|
-
|
|
8
|
+
resetContext(context, positionToUpdate, position) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (context.lastPositionLastStop.sequence !== ((_a = positionToUpdate.last_stop_sequence) !== null && _a !== void 0 ? _a : position === null || position === void 0 ? void 0 : position.last_stop_sequence)) {
|
|
10
11
|
context.lastPositionLastStop.arrival_time = null;
|
|
11
12
|
context.lastPositionLastStop.sequence = null;
|
|
12
13
|
context.lastPositionLastStop.departure_time = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractDelayAtStop.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.ts"],"names":[],"mappings":";;AAEA,gDAA8C;AAE9C,MAA8B,mBAAmB;IAanC,eAAe,CAAC,eAAgC,EAAE,iBAAyB;QACjF,OAAO,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAChG,CAAC;IAES,YAAY,
|
|
1
|
+
{"version":3,"file":"AbstractDelayAtStop.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.ts"],"names":[],"mappings":";;AAEA,gDAA8C;AAE9C,MAA8B,mBAAmB;IAanC,eAAe,CAAC,eAAgC,EAAE,iBAAyB;QACjF,OAAO,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAChG,CAAC;IAES,YAAY,CAClB,OAA0B,EAC1B,gBAAmC,EACnC,QAA6C;;QAE7C,IAAI,OAAO,CAAC,oBAAoB,CAAC,QAAQ,KAAK,CAAC,MAAA,gBAAgB,CAAC,kBAAkB,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,kBAAkB,CAAC,EAAE;YACjH,OAAO,CAAC,oBAAoB,CAAC,YAAY,GAAG,IAAI,CAAC;YACjD,OAAO,CAAC,oBAAoB,CAAC,QAAQ,GAAG,IAAI,CAAC;YAC7C,OAAO,CAAC,oBAAoB,CAAC,cAAc,GAAG,IAAI,CAAC;SACtD;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAES,4BAA4B,CAAC,OAA0B,EAAE,gBAAmC;QAClG,IAAI,OAAO,CAAC,oBAAoB,CAAC,YAAY,IAAI,gBAAgB,CAAC,sBAAsB,EAAE;YACtF,gBAAgB,CAAC,kBAAkB,GAAG,IAAI,CAAC,eAAe,CACtD,OAAO,CAAC,oBAAoB,CAAC,YAAY,EACzC,gBAAgB,CAAC,sBAAsB,CAC1C,CAAC;SACL;QACD,IACI,OAAO,CAAC,oBAAoB,CAAC,cAAc;YAC3C,gBAAgB,CAAC,wBAAwB;YACzC,gBAAgB,CAAC,cAAc,KAAK,yBAAiB,CAAC,OAAO;YAC7D,gBAAgB,CAAC,cAAc,KAAK,yBAAiB,CAAC,WAAW,EACnE;YACE,gBAAgB,CAAC,oBAAoB,GAAG,IAAI,CAAC,eAAe,CACxD,OAAO,CAAC,oBAAoB,CAAC,cAAc,EAC3C,gBAAgB,CAAC,wBAAwB,CAC5C,CAAC;SACL;QAED,OAAO,gBAAgB,CAAC;IAC5B,CAAC;CACJ;AApDD,sCAoDC"}
|
|
@@ -7,18 +7,18 @@ 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;
|
|
11
|
-
context = this.resetContext(context, positionToUpdate);
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
context = this.resetContext(context, positionToUpdate, position);
|
|
12
12
|
if (position && position.state_position === const_1.StatePositionEnum.AT_STOP) {
|
|
13
13
|
context.lastPositionLastStop.arrival_time = (_a = context.lastPositionLastStop.arrival_time) !== null && _a !== void 0 ? _a : position.origin_timestamp;
|
|
14
|
-
context.lastPositionLastStop.sequence = (_b = positionToUpdate.this_stop_sequence) !== null && _b !== void 0 ? _b : null;
|
|
14
|
+
context.lastPositionLastStop.sequence = (_c = (_b = positionToUpdate.this_stop_sequence) !== null && _b !== void 0 ? _b : position.this_stop_sequence) !== null && _c !== void 0 ? _c : null;
|
|
15
15
|
context.lastPositionLastStop.departure_time = position.origin_timestamp;
|
|
16
16
|
}
|
|
17
17
|
return context;
|
|
18
18
|
}
|
|
19
19
|
updatePosition(context, positionToUpdate, position) {
|
|
20
20
|
positionToUpdate = this.updatePositionBasedOnContext(context, positionToUpdate);
|
|
21
|
-
if (position &&
|
|
21
|
+
if (position && positionToUpdate.state_position === const_1.StatePositionEnum.AT_STOP && !positionToUpdate.delay_stop_arrival) {
|
|
22
22
|
positionToUpdate.delay_stop_arrival = this.calcDelayAtStop(position.origin_timestamp, positionToUpdate.last_stop_arrival_time);
|
|
23
23
|
}
|
|
24
24
|
return positionToUpdate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BusDelayAtStop.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/helpers/compute-positions/strategy/BusDelayAtStop.ts"],"names":[],"mappings":";;;;;AAEA,gDAA8C;AAC9C,gFAAwD;AAExD,MAAqB,cAAe,SAAQ,6BAAmB;IACpD,aAAa,CAChB,OAA0B,EAC1B,gBAAmC,EACnC,QAA6C;;QAE7C,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"BusDelayAtStop.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/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AtStop extends AbstractDelayAtStop_1.default {
|
|
9
9
|
updateContext(context, positionToUpdate, position) {
|
|
10
10
|
var _a;
|
|
11
|
-
context = this.resetContext(context, positionToUpdate);
|
|
11
|
+
context = this.resetContext(context, positionToUpdate, position);
|
|
12
12
|
if (this.didTramArrive(position)) {
|
|
13
13
|
context.lastPositionLastStop.arrival_time = position.origin_timestamp;
|
|
14
14
|
context.lastPositionLastStop.sequence = (_a = positionToUpdate.this_stop_sequence) !== null && _a !== void 0 ? _a : null;
|
|
@@ -33,8 +33,9 @@ class TramDelayAtStop extends AbstractDelayAtStop_1.default {
|
|
|
33
33
|
return (position === null || position === void 0 ? void 0 : position.tcp_event) === const_1.TCPEventEnum.ARRIVAL_ANNOUNCED && position.tracking === const_1.PositionTrackingEnum.TRACKING;
|
|
34
34
|
}
|
|
35
35
|
didTramDeparture(position, positionToUpdate, context) {
|
|
36
|
+
var _a;
|
|
36
37
|
return ((position === null || position === void 0 ? void 0 : position.tcp_event) === const_1.TCPEventEnum.DEPARTURED &&
|
|
37
|
-
context.lastPositionLastStop.sequence === positionToUpdate.last_stop_sequence &&
|
|
38
|
+
context.lastPositionLastStop.sequence === ((_a = position === null || position === void 0 ? void 0 : position.last_stop_sequence) !== null && _a !== void 0 ? _a : positionToUpdate.last_stop_sequence) &&
|
|
38
39
|
position.tracking === const_1.PositionTrackingEnum.TRACKING);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TramDelayAtStop.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/helpers/compute-positions/strategy/TramDelayAtStop.ts"],"names":[],"mappings":";;;;;AAEA,gDAA+D;AAC/D,gFAAwD;AAExD,MAAqB,eAAgB,SAAQ,6BAAmB;IACrD,aAAa,CAChB,OAA0B,EAC1B,gBAAmC,EACnC,QAAiC;;QAEjC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"TramDelayAtStop.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/helpers/compute-positions/strategy/TramDelayAtStop.ts"],"names":[],"mappings":";;;;;AAEA,gDAA+D;AAC/D,gFAAwD;AAExD,MAAqB,eAAgB,SAAQ,6BAAmB;IACrD,aAAa,CAChB,OAA0B,EAC1B,gBAAmC,EACnC,QAAiC;;QAEjC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAEjE,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC9B,OAAO,CAAC,oBAAoB,CAAC,YAAY,GAAG,QAAQ,CAAC,gBAAgB,CAAC;YACtE,OAAO,CAAC,oBAAoB,CAAC,QAAQ,GAAG,MAAA,gBAAgB,CAAC,kBAAkB,mCAAI,IAAI,CAAC;YACpF,OAAO,CAAC,oBAAoB,CAAC,cAAc,GAAG,IAAI,CAAC;SACtD;aAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE;YACnE,OAAO,CAAC,oBAAoB,CAAC,cAAc,GAAG,QAAQ,CAAC,gBAAgB,CAAC;SAC3E;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,cAAc,CACjB,OAA0B,EAC1B,gBAAmC,EACnC,QAA6C;QAE7C,gBAAgB,GAAG,IAAI,CAAC,4BAA4B,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAEhF,IAAI,QAAQ,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC1C,gBAAgB,CAAC,kBAAkB,GAAG,IAAI,CAAC,eAAe,CACtD,QAAQ,CAAC,gBAAgB,EACzB,gBAAgB,CAAC,sBAAuB,CAC3C,CAAC;SACL;aAAM,IAAI,QAAQ,IAAI,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAA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