From fb27881a18dffb3ad65be58edcbdf5a363542847 Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Sat, 15 Jun 2024 10:03:33 +0200 Subject: [PATCH] fix: train continuation broken when on the last calling point Closes #240 --- .../systems/stations/AmeyPhil.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/announcement-data/systems/stations/AmeyPhil.tsx b/src/announcement-data/systems/stations/AmeyPhil.tsx index bfded7433..770cef6e7 100644 --- a/src/announcement-data/systems/stations/AmeyPhil.tsx +++ b/src/announcement-data/systems/stations/AmeyPhil.tsx @@ -4275,7 +4275,7 @@ export default class AmeyPhil extends StationAnnouncementSystem { files.push( ...this.pluraliseAudio( - rrbCalls.map(s => `station.m.${s.crsCode}`).concat(restartedTrainCalls.length > 0 ? [] : [`station.m.${terminatingStation}`]), + rrbCalls.map(s => `station.m.${s.crsCode}`).concat(restartAsTrainAfterIndex !== -1 ? [] : [`station.m.${terminatingStation}`]), { andId: 'm.and', firstItemDelay: this.callingPointsOptions.afterCallingAtDelay, @@ -4286,16 +4286,18 @@ export default class AmeyPhil extends StationAnnouncementSystem { ), ) - if (restartedTrainCalls.length > 0) { + if (restartAsTrainAfterIndex !== -1) { files.push( 'm.where the train will restart for-2', - ...this.pluraliseAudio(restartedTrainCalls.map(s => `station.m.${s.crsCode}`).concat([`station.e.${terminatingStation}`]), { - andId: 'm.and', - firstItemDelay: this.callingPointsOptions.afterCallingAtDelay, - beforeItemDelay: this.callingPointsOptions.betweenStopsDelay, - beforeAndDelay: this.callingPointsOptions.aroundAndDelay, - afterAndDelay: this.callingPointsOptions.aroundAndDelay, - }), + ...(restartedTrainCalls.length > 0 + ? this.pluraliseAudio(restartedTrainCalls.map(s => `station.m.${s.crsCode}`).concat([`station.e.${terminatingStation}`]), { + andId: 'm.and', + firstItemDelay: this.callingPointsOptions.afterCallingAtDelay, + beforeItemDelay: this.callingPointsOptions.betweenStopsDelay, + beforeAndDelay: this.callingPointsOptions.aroundAndDelay, + afterAndDelay: this.callingPointsOptions.aroundAndDelay, + }) + : [`station.m.${terminatingStation}`, 'e.only']), ) } else { files.push('e.where the train was originally due to terminate')