Skip to content

Commit d424d64

Browse files
committed
feat: Add vehicle mode into topicSuffix
1 parent 2e4d2c4 commit d424d64

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/transformer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import type Pulsar from "pulsar-client";
44
import type * as expandedApc from "./quicktype/expandedApc";
55
import { passengerCount } from "./protobuf/passengerCount";
66

7-
export const getUniqueVehicleIdFromMqttTopic = (
7+
export const getVehicleModeAndUniqueVehicleIdFromMqttTopic = (
88
topic: string,
99
): string | undefined => {
1010
const parts = topic.split("/");
1111
if (parts.length >= 9) {
12-
return parts.slice(7, 9).join("/");
12+
return parts.slice(6, 9).join("/");
1313
}
1414
return undefined;
1515
};
@@ -149,7 +149,9 @@ export const initializeTransformer = (
149149
"APC data is missing topic and thus the owning operator and its vehicle number",
150150
);
151151
} else {
152-
const mqttTopicSuffix = getUniqueVehicleIdFromMqttTopic(apcData.topic);
152+
const mqttTopicSuffix = getVehicleModeAndUniqueVehicleIdFromMqttTopic(
153+
apcData.topic,
154+
);
153155
if (mqttTopicSuffix === undefined) {
154156
logger.warn(
155157
{ topic: apcData.topic },

0 commit comments

Comments
 (0)