From ca76f28622aebe10001b6b227e9d611be85875de Mon Sep 17 00:00:00 2001 From: tgoulder4 <118992509+tgoulder4@users.noreply.github.com> Date: Sun, 27 Aug 2023 19:36:23 +0100 Subject: [PATCH] fix N/A for non departed services --- dist/src/trackTrain.js | 5 +++-- src/trackTrain.ts | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/src/trackTrain.js b/dist/src/trackTrain.js index 5b464e8..88c2e20 100644 --- a/dist/src/trackTrain.js +++ b/dist/src/trackTrain.js @@ -287,7 +287,8 @@ function getCurrentState($) { const noReport = lastActioned.find(".noreport").length != 0; const passStation = lastActioned.find(".pass").length != 0; //if arr,dep,stopshere - if (isActualArrival && isActualDeparture) { + if ((isActualArrival && isActualDeparture) || + (!isActualArrival && isActualDeparture && !passStation)) { return stateObject("Departed", (0, getInfo_1.getInfo)(lastActioned).body, "continue", callingPoints); } //if arr,dep,stopshere @@ -295,7 +296,7 @@ function getCurrentState($) { return stateObject("At platform", (0, getInfo_1.getInfo)(lastActioned).body, "continue", callingPoints); } //if dep,!stopshere - if (passStation) { + if (!isActualArrival && isActualDeparture && passStation) { return stateObject("Passed", (0, getInfo_1.getInfo)(lastActioned).body, "continue", callingPoints); } //if dep, !stopshere diff --git a/src/trackTrain.ts b/src/trackTrain.ts index 29f8810..0827cf9 100644 --- a/src/trackTrain.ts +++ b/src/trackTrain.ts @@ -315,7 +315,10 @@ export function getCurrentState($: cheerio.Root): state { const noReport = lastActioned.find(".noreport").length != 0; const passStation = lastActioned.find(".pass").length != 0; //if arr,dep,stopshere - if (isActualArrival && isActualDeparture) { + if ( + (isActualArrival && isActualDeparture) || + (!isActualArrival && isActualDeparture && !passStation) + ) { return stateObject( "Departed", getInfo(lastActioned).body, @@ -333,7 +336,7 @@ export function getCurrentState($: cheerio.Root): state { ); } //if dep,!stopshere - if (passStation) { + if (!isActualArrival && isActualDeparture && passStation) { return stateObject( "Passed", getInfo(lastActioned).body,