Add supression for non-public trains

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-09-21 21:17:58 +01:00
parent 3590b15a69
commit 8bab3ddda5

View File

@ -82,7 +82,7 @@ function transformTrainServices(input: any): TrainServices[] {
operatorCode: service?.operatorCode || "UK",
platform: service?.platform || "-",
platformIsHidden: service?.platformIsHidden,
serviceIsSupressed: service?.serviceIsSupressed,
serviceIsSupressed: checkIsSupressed(service).toString(),
origin: transformLocation(service?.origin),
destination: transformLocation(service?.destination),
length: calculateLength(service),
@ -106,6 +106,11 @@ 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 transformLocation(input: any): ServiceLocation[] {
//console.log("Transform Location Running")
let output: ServiceLocation[] = [];