diff --git a/src/components/Panels/OrderListPanel.vue b/src/components/Panels/OrderListPanel.vue index 0369272..2e27ff0 100644 --- a/src/components/Panels/OrderListPanel.vue +++ b/src/components/Panels/OrderListPanel.vue @@ -12,7 +12,7 @@ :selected="order.id == store.chosenLocalOrderId" :key="order.id" > - #{{ order.id.split('-')[1] }}  + #{{ order.id.split('-')[2] }}  {{ 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); }); diff --git a/src/components/Panels/OrderMessagePanel.vue b/src/components/Panels/OrderMessagePanel.vue index 44e8c4d..c9568bb 100644 --- a/src/components/Panels/OrderMessagePanel.vue +++ b/src/components/Panels/OrderMessagePanel.vue @@ -26,7 +26,7 @@ {{ $t('order-message.button-update') }} - {{ store.chosenLocalOrderId && `#${store.chosenLocalOrderId.split('-')[1]}` }} + {{ store.chosenLocalOrderId && `#${store.chosenLocalOrderId.split('-')[2]}` }} @@ -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; diff --git a/src/locales/en.json b/src/locales/en.json index 9f147ba..bdee259 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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:",