File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 3
3
from random import random
4
4
from time import sleep
5
5
from typing import Dict , List , NoReturn , Union
6
+ import copy
6
7
7
8
from progress .spinner import Spinner
8
9
@@ -104,6 +105,14 @@ def _job(self) -> None:
104
105
except TgtgAPIError as err :
105
106
log .error (err )
106
107
items += self ._get_favorites ()
108
+
109
+ # if state is empty (first scanning iteration), initialize it with the current favorite items and set `items_available` property to 0.
110
+ # It allows to be able to receive notifications at start if some magic bags are already available.
111
+ if not self .state :
112
+ self .state = {item .item_id : copy .deepcopy (item ) for item in items }
113
+ for item in self .state .values ():
114
+ item .items_available = 0
115
+
107
116
for item in items :
108
117
self ._check_item (item )
109
118
You can’t perform that action at this time.
0 commit comments