newStaffLDB-API #48
@ -82,7 +82,7 @@ function transformTrainServices(input: any): TrainServices[] {
|
||||
operatorCode: service?.operatorCode || "UK",
|
||||
platform: service?.platform || "-",
|
||||
platformIsHidden: service?.platformIsHidden,
|
||||
serviceIsSupressed: checkIsSupressed(service).toString(),
|
||||
serviceIsSupressed: checkIsSupressed(service),
|
||||
origin: transformLocation(service?.origin),
|
||||
destination: transformLocation(service?.destination),
|
||||
length: calculateLength(service),
|
||||
@ -106,9 +106,12 @@ function transformTrainServices(input: any): TrainServices[] {
|
||||
return output;
|
||||
}
|
||||
|
||||
function checkIsSupressed(service: TrainServices): boolean {
|
||||
// RETURN TRUE if 'serviceIsSupressed' OR 'isNonPublic'
|
||||
return service.serviceIsSupressed == "true" || service.isNonPublic == "true";
|
||||
function checkIsSupressed(service: TrainServices): string | undefined {
|
||||
if (service.serviceIsSupressed === "true" || service.isNonPublic === "true") {
|
||||
return "true";
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function transformLocation(input: any): ServiceLocation[] {
|
||||
|
Loading…
Reference in New Issue
Block a user