Poprawki funkcjonalności

This commit is contained in:
2022-07-30 16:42:07 +02:00
parent 767e0839e0
commit 27405485bd
10 changed files with 217 additions and 88 deletions
-22
View File
@@ -1,22 +0,0 @@
import { EVehicleUseType } from "../enums/EVehicleUseType";
import { IStock } from "../types";
export const verifyTrainSpec = (stockList: IStock[], vehicleMass: number, vehicleUseType: string) => {
const hasHeadLoco = stockList.length > 0
&& (stockList[0].useType == EVehicleUseType.LOCO_ELECTRICAL
|| stockList[0].useType == EVehicleUseType.LOCO_DIESEL);
if (!hasHeadLoco) return;
const headLoco = stockList[0];
const carList = stockList.filter(stock => !stock.isLoco);
const isTrainPassenger = carList.length != 0
? carList.every(stock => stock.useType == EVehicleUseType.CAR_PASSENGER)
&& vehicleUseType == EVehicleUseType.CAR_PASSENGER
: false;
}
+1 -1
View File
@@ -103,7 +103,7 @@ export function carDataList(state: IStore) {
const carPropsData = vehiclePropsJSON.find((v) => car[0].toString().includes(v.type));
acc.push({
useType: vehicleTypeKey,
useType: vehicleTypeKey as 'car-passenger' | 'car-cargo',
type: car[0] as string,
constructionType: car[1] as string,
loadable: car[2] as boolean,