chore: changed to new order's version in local storage

This commit is contained in:
2025-10-11 00:39:29 +02:00
parent 201c49845f
commit 33f59db5f3
3 changed files with 10 additions and 15 deletions
+3 -8
View File
@@ -12,7 +12,7 @@
:selected="order.id == store.chosenLocalOrderId"
:key="order.id"
>
<b class="text--accent">#{{ order.id.split('-')[1] }}&nbsp;</b>
<b class="text--accent">#{{ order.id.split('-')[2] }}&nbsp;</b>
<b>
{{
t('order-list.order-title', {
@@ -80,7 +80,7 @@ function removeOrder(orderId: string) {
const orderIndex = storageOrderList.findIndex((o) => o.id == orderId);
if (orderIndex != -1) storageOrderList.splice(orderIndex, 1);
if (storageOrderList.length == 0) StorageManager.setNumericValue('orderCount', 0);
if (storageOrderList.length == 0) StorageManager.setNumericValue('orderCountV3', 0);
}
function selectLocalOrder(order: IStorageOrderData) {
@@ -116,10 +116,8 @@ onActivated(() => {
const localStorage = window.localStorage;
const orderList = [];
let deprecatedOrders = 0;
for (let key in localStorage) {
if (!/^order-/g.test(key)) continue;
if (!/^order-v3/g.test(key)) continue;
const orderObj: IStorageOrderData | LocalStorageOrderLegacy = JSON.parse(localStorage[key]);
if (!orderObj) continue;
@@ -132,9 +130,6 @@ onActivated(() => {
orderList.push(orderObj);
}
if (deprecatedOrders != 0) {
}
storageOrderList.length = 0;
storageOrderList.push(...orderList);
});
+6 -6
View File
@@ -26,7 +26,7 @@
<LucidePencil />
{{ $t('order-message.button-update') }}
<span class="text--accent">
{{ store.chosenLocalOrderId && `#${store.chosenLocalOrderId.split('-')[1]}` }}
{{ store.chosenLocalOrderId && `#${store.chosenLocalOrderId.split('-')[2]}` }}
</span>
</button>
@@ -317,11 +317,11 @@ function saveOrder() {
orderData: store.orderData
};
const localOrderCount = StorageManager.getNumericValue('orderCount') || 0;
const localOrderCount = StorageManager.getNumericValue('orderCountV3') || 0;
if (localOrderCount == 0) StorageManager.setNumericValue('orderCount', 0);
if (localOrderCount == 0) StorageManager.setNumericValue('orderCountV3', 0);
const prevLocalOrder = StorageManager.getValue(`order-${localOrderCount}`);
const prevLocalOrder = StorageManager.getValue(`order-v3-${localOrderCount}`);
if (prevLocalOrder) {
try {
@@ -339,10 +339,10 @@ function saveOrder() {
}
const nextOrderCount = localOrderCount + 1;
const nextOrderId = `order-${nextOrderCount}`;
const nextOrderId = `order-v3-${nextOrderCount}`;
orderDataToSave['id'] = nextOrderId;
StorageManager.setNumericValue('orderCount', nextOrderCount);
StorageManager.setNumericValue('orderCountV3', nextOrderCount);
StorageManager.setValue(nextOrderId, JSON.stringify(orderDataToSave));
store.chosenLocalOrderId = nextOrderId;
+1 -1
View File
@@ -55,7 +55,7 @@
},
"order-list": {
"title": "Saved train orders",
"order-title": "Train order for train no. {trainNo}",
"order-title": "Train order for no. {trainNo}",
"order-subtitle": "Selected instructions: {0}",
"no-saved-orders": "No saved orders!",
"order-added": "Added:",