From a34c8807dea8ffd1087c2a12f0fb202cf5d58e66 Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 10 Feb 2025 17:09:49 +0100 Subject: [PATCH 1/4] 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() ?? ''; From 6a23821f9c87493f4204e4f144796354d007ad78 Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 10 Feb 2025 17:10:09 +0100 Subject: [PATCH 2/4] bump: v1.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 29580cc..e0493b5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "srjp-td2", "private": true, - "version": "1.0.2", + "version": "1.0.3", "type": "module", "scripts": { "dev": "vite --mode staging", From 0431153326c2940ed2601a552d466026c1add876 Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 10 Feb 2025 17:32:24 +0100 Subject: [PATCH 3/4] hotfix: border colors & rendering --- src/components/Timetable/TimetableBody.vue | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/Timetable/TimetableBody.vue b/src/components/Timetable/TimetableBody.vue index 8a6afa4..ac1f7fa 100644 --- a/src/components/Timetable/TimetableBody.vue +++ b/src/components/Timetable/TimetableBody.vue @@ -26,20 +26,21 @@ From 4de4991ff630d2014c93769ea83032f4536dd5cb Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 10 Feb 2025 21:23:36 +0100 Subject: [PATCH 4/4] fix: generating arrival km --- src/components/Timetable/TrainTimetable.vue | 29 ++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/components/Timetable/TrainTimetable.vue b/src/components/Timetable/TrainTimetable.vue index 6db7ce7..0992660 100644 --- a/src/components/Timetable/TrainTimetable.vue +++ b/src/components/Timetable/TrainTimetable.vue @@ -89,9 +89,10 @@ const computedTimetableRows = computed(() => { for (const stop of stopList) { if (stop.arrivalLine && stop.arrivalLine == currentPath.arrivalLine) { - console.log('arrivalKm', arrivalKm, stop.stopDistance); + console.log('arrivalKm', arrivalKm); + console.log('stopDistance', stop.stopDistance); - if (arrivalKm >= stop.stopDistance) arrivalKm = stop.stopDistance; + if (arrivalKm >= stop.stopDistance) arrivalKm = (Number(stopRows[stopRows.length - 1].departureKm ?? '0') + stop.stopDistance) / 2; if (currentPath.arrivalLineData) { arrivalSpeed = currentPath.arrivalLineData.routeSpeed; @@ -171,14 +172,17 @@ const computedTimetableRows = computed(() => { } if (stop.departureLine && stop.departureLine == currentPath.departureLine) { + arrivalKm = stop.stopDistance; + // Reverse search for last scenery checkpoint if (currentPath.departureLineData) { - console.log(stop.departureLine, currentPath.sceneryName, stop.stopDistance, currentPath.departureLineData.routeLength); + if (currentPath.departureLineData.routeLength != 0 && !currentPath.departureLineData.isRouteSBL) + arrivalKm = stop.stopDistance + currentPath.departureLineData.routeLength / 1000; - if (currentPath.departureLineData.isRouteSBL) arrivalKm = stop.stopDistance + (currentPath.departureLineData.routeSpeed <= 130 ? 1.0 : 2.0); - else arrivalKm = stop.stopDistance + currentPath.departureLineData.routeLength / 1000; + if (stopRows[stopRows.length - 1].isMain && currentPath.departureLineData.isRouteSBL && stop.departureLine == currentPath.departureLine) + arrivalKm = stop.stopDistance + currentPath.departureLineData.routeLength / 1000; - for (let i = stopRows.length - 1; i > 0; i--) { + 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() ?? ''; @@ -187,6 +191,19 @@ const computedTimetableRows = computed(() => { stopRows[i].departureSpeed = currentPath.departureLineData.routeSpeed; stopRows[i].departureTracks = currentPath.departureLineData.routeTracks; + console.log( + stop.departureLine, + currentPath.sceneryName, + stop.stopDistance, + currentPath.departureLineData.routeLength, + currentPath.departureLineData.isRouteSBL + ); + + /* + if (currentPath.departureLineData.isRouteSBL) + arrivalKm = stop.stopDistance + (currentPath.departureLineData.routeSpeed <= 130 ? 1.0 : 2.0); + else */ + abbrevs = getAbbrevs(currentPath.departureLineData); stopRows[i].abbrevs = abbrevs; break;
{{ row.arrivalKm }}