code adaptation for API changes; tons changed to kilos

This commit is contained in:
2024-02-19 17:37:46 +01:00
parent 77cb64e25a
commit 83f5b07c7e
25 changed files with 365 additions and 234 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
import { defineComponent } from 'vue';
import { useStore } from '../store';
import { ICargo, ICarWagon, ILocomotive, IStock, Vehicle } from '../types';
import { ICarWagon, ILocomotive, IStock, ICargo, Vehicle } from '../types';
import { isLocomotive } from '../utils/vehicleUtils';
export default defineComponent({
@@ -22,7 +22,7 @@ export default defineComponent({
id: this.getStockId(),
type: vehicle.type,
length: vehicle.length,
mass: vehicle.mass,
weight: vehicle.weight,
maxSpeed: vehicle.maxSpeed,
isLoco,
cargo: !isLoco && vehicle.loadable && cargo ? cargo : undefined,
@@ -88,7 +88,7 @@ export default defineComponent({
const [carType, cargo] = type.split(':');
vehicle = this.store.carDataList.find((car) => car.type == carType) || null;
if (cargo) vehicleCargo = vehicle?.cargoList.find((c) => c.id == cargo) || null;
if (cargo) vehicleCargo = vehicle?.cargoTypes.find((c) => c.id == cargo) || null;
}
if (!vehicle) console.log('Brak pojazdu / rodzaj pojazdu źle wczytany:', type);
+5 -13
View File
@@ -1,5 +1,5 @@
import { defineComponent } from "vue";
import { useStore } from "../store";
import { defineComponent } from 'vue';
import { useStore } from '../store';
export default defineComponent({
setup() {
@@ -11,17 +11,11 @@ export default defineComponent({
},
computed: {
trainTooLong() {
return (
(this.store.totalLength > 350 && this.store.isTrainPassenger) ||
(this.store.totalLength > 650 && !this.store.isTrainPassenger)
);
return (this.store.totalLength > 350 && this.store.isTrainPassenger) || (this.store.totalLength > 650 && !this.store.isTrainPassenger);
},
trainTooHeavy() {
return (
this.store.acceptableMass &&
this.store.totalMass > this.store.acceptableMass
);
return this.store.acceptableWeight && this.store.totalWeight > this.store.acceptableWeight;
},
locoNotSuitable() {
@@ -29,9 +23,7 @@ export default defineComponent({
!this.store.isTrainPassenger &&
this.store.stockList.length > 1 &&
!this.store.stockList.every((stock) => stock.isLoco) &&
this.store.stockList.some(
(stock) => stock.isLoco && stock.type.startsWith("EP"),
)
this.store.stockList.some((stock) => stock.isLoco && stock.type.startsWith('EP'))
);
},