From 96702b60d41f35e7bba5e6f85ad9c96d5397a1c7 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 16 Jul 2024 16:51:17 +0200 Subject: [PATCH] Adding migration update --- changedetectionio/store.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/changedetectionio/store.py b/changedetectionio/store.py index d42e7503..0d88f8b2 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -867,4 +867,17 @@ class ChangeDetectionStore: watch['restock'] = Restock({'in_stock': watch.get('in_stock')}) del watch['in_stock'] + # Migrate old restock settings + def update_18(self): + for uuid, watch in self.data['watching'].items(): + if not watch.get('restock_settings'): + # So we enable price following by default + self.data['watching'][uuid]['restock_settings'] = {'follow_price_changes': True} + + # Migrate and cleanoff old value + self.data['watching'][uuid]['restock_settings']['in_stock_processing'] = 'in_stock_only' if watch.get( + 'in_stock_only') else 'all_changes' + + if self.data['watching'][uuid].get('in_stock_only'): + del (self.data['watching'][uuid]['in_stock_only'])