mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 05:18:10 +00:00
refactor: moved file utils to composable mixin
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { useStore } from '../store';
|
||||
|
||||
export function getCurrentStockFileName() {
|
||||
const store = useStore();
|
||||
|
||||
let fileName = '';
|
||||
|
||||
if (store.chosenStorageStockName.trim() != '') {
|
||||
return store.chosenStorageStockName;
|
||||
}
|
||||
|
||||
const currentStockString = store.stockList.map((s) => s.vehicleRef.type).join(';');
|
||||
|
||||
const currentRealComp = store.realCompositionList.find((rc) => rc.stockString == currentStockString);
|
||||
|
||||
// Append real composition to the name if chosen
|
||||
if (currentRealComp != undefined) {
|
||||
fileName += `${currentRealComp.stockId} `;
|
||||
}
|
||||
|
||||
// Append default props
|
||||
fileName += `${store.stockList[0].vehicleRef.type} ${(store.totalWeight / 1000).toFixed(1)}t; ${store.totalLength}m; vmax ${store.maxStockSpeed}`;
|
||||
|
||||
return fileName;
|
||||
}
|
||||
Reference in New Issue
Block a user