From c63a186d32b8b29ae0d3b99edc5046059afd8867 Mon Sep 17 00:00:00 2001 From: Tiago Epifanio Date: Sun, 19 Mar 2023 23:51:39 +0000 Subject: [PATCH 1/2] On harvest confirmation message, default to Y when user presses return --- menu_screen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu_screen.py b/menu_screen.py index 441593b..ac91088 100644 --- a/menu_screen.py +++ b/menu_screen.py @@ -633,7 +633,7 @@ class CursedMenu(object): if user_in == -1: # Input comes from pipe/file and is closed raise IOError - if user_in in [ord('Y'), ord('y')]: + if user_in in [ord('Y'), ord('y'), 10]: self.plant.start_over() else: pass From c92b3d3667ddc6e4345f04d67a921951888d90f7 Mon Sep 17 00:00:00 2001 From: Tiago Epifanio Date: Mon, 20 Mar 2023 00:26:43 +0000 Subject: [PATCH 2/2] Clean other instances of user --- botany.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/botany.py b/botany.py index 3aa5736..1f17b16 100755 --- a/botany.py +++ b/botany.py @@ -508,8 +508,6 @@ class DataManager(object): def update_garden_db(self, this_plant): # insert or update this plant id's entry in DB - # TODO: make sure other instances of user are deleted - # Could create a clean db function self.init_database() self.migrate_database() age_formatted = self.plant_age_convert(this_plant) @@ -528,6 +526,13 @@ class DataManager(object): psco = str(this_plant.ticks), pdead = int(this_plant.dead)) c.execute(update_query) + # clean other instances of user + clean_query = """UPDATE garden set is_dead = 1 + where owner = '{pown}' + and plant_id <> '{pid}' + """.format(pown = this_plant.owner, + pid = this_plant.plant_id) + c.execute(clean_query) conn.commit() conn.close()