Skip to content

Commit c73257b

Browse files
authored
Merge pull request #507 from HSLdevcom/AB#134-fix-duplicate-screens
AB#134 Fixes a bug where screens were saved under different ids
2 parents c627d6b + 3e51019 commit c73257b

5 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/ui/MonitorRow.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export interface IStop {
1717
gtfsId: string;
1818
code: string;
1919
platformCode: string;
20-
parentStation: any;
20+
parentStation: {
21+
gtfsId: string;
22+
};
2123
}
2224
interface ITrip {
2325
tripHeadsign: string;

src/ui/StopCardRow.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,7 @@ const StopCardRow: FC<IProps> = ({
189189
'shortName.length',
190190
),
191191
hiddenRoutes: [],
192-
parentStation: stop.parentStation
193-
? stop.parentStation.gtfsId
194-
: undefined,
192+
parentStation: stop.parentStation || null
195193
};
196194
}),
197195
undefined,

src/ui/TrainDataFetcher.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ const TrainDataFetcher: FC<IProps> = ({
8888
const shortCodes = stopAndRoutes
8989
.map(stop => {
9090
return {
91-
gtfsId: stop.parentStation,
92-
shortCode: stop?.shortCode || stop.parentStation.split(':')[1],
91+
gtfsId: stop.parentStation.gtfsId,
92+
shortCode: stop?.shortCode || stop.parentStation.gtfsId.split(':')[1],
9393
};
9494
})
9595
.filter(s => s);

src/ui/TrainDataPreparer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ const createLineIdsArray = (data, hiddenRoutes) => {
2626
if (!filteredHiddenRoutes.includes(stringifyPattern(pattern))) {
2727
lineIds.push({
2828
gtfsId: stop.gtfsId,
29-
parentStation: station.gtfsId,
29+
parentStation: {
30+
gtfsId: station.gtfsId
31+
},
3032
shortName: pattern.route.shortName,
3133
stringifiedPattern: stringifyPattern(pattern),
3234
});
@@ -43,9 +45,7 @@ const createLineIdsArray = (data, hiddenRoutes) => {
4345
if (!filteredHiddenRoutes.includes(stringifyPattern(pattern))) {
4446
lineIds.push({
4547
gtfsId: stop.gtfsId,
46-
parentStation: stop.parentStation
47-
? stop.parentStation.gtfsId
48-
: stop.gtfsId,
48+
parentStation: stop.parentStation || null,
4949
shortName: pattern.route.shortName,
5050
stringifiedPattern: stringifyPattern(pattern),
5151
});

src/util/Interfaces.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export interface IStop {
1212
settings?: ISettings;
1313
mode?: string;
1414
routes?: Array<any>;
15-
parentStation?: string;
15+
parentStation?: {
16+
gtfsId: string;
17+
};
1618
}
1719
export interface IStopInfoPlus extends IStop {
1820
cardId?: number;
@@ -141,7 +143,9 @@ export interface ICard {
141143
gtfsId: string;
142144
shortCode: string;
143145
source: string;
144-
parentStation: string;
146+
parentStation: {
147+
gtfsId: string;
148+
};
145149
hiddenRoutes: any;
146150
}
147151
export interface ICardInfo {

0 commit comments

Comments
 (0)