Der-Henning / tgtg

Scanner for Too Good To Go Notifications
https://github.com/Der-Henning/tgtg/wiki
GNU General Public License v3.0
413 stars 67 forks source link

[Logic Improvement] Enable notifications for the first iteration of the scanner when the state is empty #548

Open ThomasDelsart opened 2 weeks ago

ThomasDelsart commented 2 weeks ago

In this first iteration of the scanner, the self.state variable is initialized as an empty dictionary and only populated after the first notification command is executed. This means that in the initial scan, notifications are not sent for magic bags already available in the TGTG application.

Since the second scan does not detect changes (if no new magic bags are added), no notifications are sent for the already available magic bags.

To address this, I propose a minor logic improvement by initializing the self.state variable before the first notification command is triggered.

Additionally, to pass the pre-commit checks, I ran poetry lockto update dependencies, as poetry lock --no-updatewas unsuccessful. The app continues to run smoothly with these changes.