mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 11:45:34 +00:00
Poprawki optymalizacyjne; dodanie ostrzeżeń
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { EVehicleUseType } from "@/enums/EVehicleUseType";
|
||||
import { ICarWagon, ILocomotive, 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);
|
||||
|
||||
console.log(carList, vehicleUseType);
|
||||
|
||||
|
||||
const isTrainPassenger = carList.length != 0
|
||||
? carList.every(stock => stock.useType == EVehicleUseType.CAR_PASSENGER)
|
||||
&& vehicleUseType == EVehicleUseType.CAR_PASSENGER
|
||||
: false;
|
||||
|
||||
console.log("Skład pasażerski: " + isTrainPassenger);
|
||||
console.log("Skład towarowy: " + !isTrainPassenger);
|
||||
}
|
||||
Reference in New Issue
Block a user