fix: logic for checking if PRSM4 is at the end

This commit is contained in:
2025-11-05 01:33:29 +01:00
parent 3a17f7485f
commit 56dc42b58e
@@ -1,8 +1,6 @@
<template> <template>
<div class="stock_warnings" v-if="hasAnyWarnings"> <div class="stock_warnings" v-if="hasAnyWarnings">
<div class="warning" v-if="locoNotSuitable"> <div class="warning" v-if="locoNotSuitable"><TriangleAlertIcon :size="20" :stroke-width="2" /> {{ $t('stocklist.warning-not-suitable') }}</div>
<TriangleAlertIcon :size="20" :stroke-width="2" /> {{ $t('stocklist.warning-not-suitable') }}
</div>
<div class="warning" v-if="lengthExceeded && store.isTrainPassenger"> <div class="warning" v-if="lengthExceeded && store.isTrainPassenger">
<TriangleAlertIcon :size="20" :stroke-width="2" /> {{ $t('stocklist.warning-passenger-too-long') }} <TriangleAlertIcon :size="20" :stroke-width="2" /> {{ $t('stocklist.warning-passenger-too-long') }}
@@ -81,7 +79,9 @@ export default defineComponent({
isRearPRSM4() { isRearPRSM4() {
if (this.store.stockList.length <= 1) return true; if (this.store.stockList.length <= 1) return true;
return this.store.stockList.findIndex((stock) => stock.vehicleRef.type.startsWith('PRSM4')) == (this.store.stockList.length - 1 || -1); const index = this.store.stockList.findIndex((stock) => stock.vehicleRef.type.startsWith('PRSM4'));
return index != -1 ? index == this.store.stockList.length - 1 : true;
}, },
}, },
}); });
@@ -96,7 +96,6 @@ export default defineComponent({
font-weight: bold; font-weight: bold;
.lucide { .lucide {
vertical-align: text-bottom; vertical-align: text-bottom;
} }