fix: generating arrival km

This commit is contained in:
2025-02-10 21:23:36 +01:00
parent 0431153326
commit 4de4991ff6
+23 -6
View File
@@ -89,9 +89,10 @@ const computedTimetableRows = computed(() => {
for (const stop of stopList) { for (const stop of stopList) {
if (stop.arrivalLine && stop.arrivalLine == currentPath.arrivalLine) { 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) { if (currentPath.arrivalLineData) {
arrivalSpeed = currentPath.arrivalLineData.routeSpeed; arrivalSpeed = currentPath.arrivalLineData.routeSpeed;
@@ -171,14 +172,17 @@ const computedTimetableRows = computed(() => {
} }
if (stop.departureLine && stop.departureLine == currentPath.departureLine) { if (stop.departureLine && stop.departureLine == currentPath.departureLine) {
arrivalKm = stop.stopDistance;
// Reverse search for last scenery checkpoint // Reverse search for last scenery checkpoint
if (currentPath.departureLineData) { 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); if (stopRows[stopRows.length - 1].isMain && currentPath.departureLineData.isRouteSBL && stop.departureLine == currentPath.departureLine)
else arrivalKm = stop.stopDistance + currentPath.departureLineData.routeLength / 1000; 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].departureTracks = currentPath.departureLineData.routeTracks;
stopRows[i].departureSpeed = currentPath.departureLineData.routeSpeed; stopRows[i].departureSpeed = currentPath.departureLineData.routeSpeed;
stopRows[i].realLine = currentPath.departureLineData.realLineNo?.toString() ?? ''; stopRows[i].realLine = currentPath.departureLineData.realLineNo?.toString() ?? '';
@@ -187,6 +191,19 @@ const computedTimetableRows = computed(() => {
stopRows[i].departureSpeed = currentPath.departureLineData.routeSpeed; stopRows[i].departureSpeed = currentPath.departureLineData.routeSpeed;
stopRows[i].departureTracks = currentPath.departureLineData.routeTracks; 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); abbrevs = getAbbrevs(currentPath.departureLineData);
stopRows[i].abbrevs = abbrevs; stopRows[i].abbrevs = abbrevs;
break; break;