From a34c8807dea8ffd1087c2a12f0fb202cf5d58e66 Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 10 Feb 2025 17:09:49 +0100 Subject: [PATCH] chore: improved data within Km column --- src/components/Timetable/TimetableBody.vue | 36 +++++++++++++++++---- src/components/Timetable/TrainTimetable.vue | 13 ++++++-- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/components/Timetable/TimetableBody.vue b/src/components/Timetable/TimetableBody.vue index 1cac990..8a6afa4 100644 --- a/src/components/Timetable/TimetableBody.vue +++ b/src/components/Timetable/TimetableBody.vue @@ -11,15 +11,39 @@ {{ i == 0 || computedTimetable[i - 1].realLine != row.realLine ? row.realLine : ' ' }} - -
+ +
- - + + - - + +
{{ row.arrivalKm == '0.000' ? '' : row.arrivalKm }}
{{ row.arrivalKm }}
{{ row.departureKm == '0.000' ? '' : row.departureKm }}
{{ row.departureKm == '0.000' ? '' : row.departureKm }}
diff --git a/src/components/Timetable/TrainTimetable.vue b/src/components/Timetable/TrainTimetable.vue index b3bb750..6db7ce7 100644 --- a/src/components/Timetable/TrainTimetable.vue +++ b/src/components/Timetable/TrainTimetable.vue @@ -89,7 +89,9 @@ const computedTimetableRows = computed(() => { for (const stop of stopList) { if (stop.arrivalLine && stop.arrivalLine == currentPath.arrivalLine) { - arrivalKm = stop.stopDistance; + console.log('arrivalKm', arrivalKm, stop.stopDistance); + + if (arrivalKm >= stop.stopDistance) arrivalKm = stop.stopDistance; if (currentPath.arrivalLineData) { arrivalSpeed = currentPath.arrivalLineData.routeSpeed; @@ -170,8 +172,13 @@ const computedTimetableRows = computed(() => { if (stop.departureLine && stop.departureLine == currentPath.departureLine) { // Reverse search for last scenery checkpoint - for (let i = stopRows.length - 1; i > 0; i--) { - if (currentPath.departureLineData) { + if (currentPath.departureLineData) { + console.log(stop.departureLine, currentPath.sceneryName, stop.stopDistance, currentPath.departureLineData.routeLength); + + if (currentPath.departureLineData.isRouteSBL) arrivalKm = stop.stopDistance + (currentPath.departureLineData.routeSpeed <= 130 ? 1.0 : 2.0); + else arrivalKm = stop.stopDistance + currentPath.departureLineData.routeLength / 1000; + + for (let i = stopRows.length - 1; i > 0; i--) { stopRows[i].departureTracks = currentPath.departureLineData.routeTracks; stopRows[i].departureSpeed = currentPath.departureLineData.routeSpeed; stopRows[i].realLine = currentPath.departureLineData.realLineNo?.toString() ?? '';