Skip to content

Commit

Permalink
fix: train continuation broken when on the last calling point
Browse files Browse the repository at this point in the history
Closes #240
  • Loading branch information
davwheat committed Jun 15, 2024
1 parent 20044eb commit fb27881
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/announcement-data/systems/stations/AmeyPhil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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')
Expand Down

0 comments on commit fb27881

Please sign in to comment.