Skip to content

Commit

Permalink
fix N/A for non departed services
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoulder4 committed Aug 27, 2023
1 parent 97e9b44 commit ca76f28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dist/src/trackTrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,16 @@ 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
if (isActualArrival && !isActualDeparture) {
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
Expand Down
7 changes: 5 additions & 2 deletions src/trackTrain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit ca76f28

Please sign in to comment.