Skip to content

Commit

Permalink
Fix pdfs with only 2 stops
Browse files Browse the repository at this point in the history
  • Loading branch information
ttmx committed May 20, 2024
1 parent a73c317 commit 9f86153
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async function Page({ params }:{params:{line_id:string, stop_id:s
const secondaryPatternsPromise = Promise.all(timetable.secondaryPatterns.map(patternId => fetch(`${API_URL}/patterns/${patternId}`).then(patternRes => patternRes.json())));
// console.log(patternURL, timetable.secondaryPatterns.map(patternId => `${API_URL}/patterns/${patternId}`));

const [pattern, secondaryPatterns]:[ Pattern, Pattern[] ] = await Promise.all([patternRes, secondaryPatternsPromise]);
const [pattern, secondaryPatterns]:[ Pattern, Pattern[] ] = await Promise.all([patternRes, secondaryPatternsPromise]);
if (!pattern.path || !pattern.path[1] || !pattern.path[1].stop) {
console.error(patternURL, 'pattern.path[1].stop is undefined, pattern:', pattern);
return;
Expand Down Expand Up @@ -154,8 +154,10 @@ export default async function Page({ params }:{params:{line_id:string, stop_id:s
accumulatedDelay = 0;
}
}
delays[delays.length - 1].span += 1;
delays[delays.length - 1].delay += lastStop.delay;
if (delays.length > 0) {
delays[delays.length - 1].span += 1;
delays[delays.length - 1].delay += lastStop.delay;
}

for (let stopIndex in renderedStops) {
const stop = renderedStops[stopIndex];
Expand Down

0 comments on commit 9f86153

Please sign in to comment.