From 29369dae1322efb9d74186ce7254f7133e8626d9 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 6 Apr 2021 15:50:53 -0400 Subject: [PATCH 1/6] fix visiting --- botany.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/botany.py b/botany.py index 46e6538..5ba0e4a 100755 --- a/botany.py +++ b/botany.py @@ -237,7 +237,7 @@ class Plant(object): if element['user'] not in visitors_this_check: visitors_this_check.append(element['user']) # prevent users from manually setting watered_time in the future - if element['timestamp'] <= int(time.time() and element['timestamp'] >= self.watered_timestamp): + if element['timestamp'] <= int(time.time()) and element['timestamp'] >= self.watered_timestamp: guest_timestamps.append(element['timestamp']) try: self.update_visitor_db(visitors_this_check) From 27b8733bf4fdbaeb7b225e98bd790c0e58eb409a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Fri, 13 May 2022 13:38:20 +0900 Subject: [PATCH 2/6] Update shebang --- botany-view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/botany-view.py b/botany-view.py index 5f73817..09b1c6b 100755 --- a/botany-view.py +++ b/botany-view.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 from botany import * def ascii_render(filename): From 4ba1d6d46aea56b193fb5adeff59de0d5c8c4b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ng=C3=B4=20Ng=E1=BB=8Dc=20=C4=90=E1=BB=A9c=20Huy?= Date: Fri, 20 May 2022 20:19:05 +0700 Subject: [PATCH 3/6] fix precision to first decimal place fix precision to first decimal place to avoid floating-point error --- botany.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/botany.py b/botany.py index 46e6538..966570b 100755 --- a/botany.py +++ b/botany.py @@ -354,7 +354,7 @@ class Plant(object): # Do something else pass # TODO: event check - generation_bonus = 0.2 * (self.generation - 1) + generation_bonus = round(0.2 * (self.generation - 1), 1) adjusted_sleep_time = 1 / (1 + generation_bonus) time.sleep(adjusted_sleep_time) @@ -455,7 +455,7 @@ class DataManager(object): self.last_water_gain = time.time() else: ticks_to_add = 0 - this_plant.ticks += ticks_to_add * (0.2 * (this_plant.generation - 1) + 1) + this_plant.ticks += ticks_to_add * round(0.2 * (this_plant.generation - 1) + 1, 1) return this_plant def plant_age_convert(self,this_plant): From 36b6507766a47172803a397bd4e9386c8d476464 Mon Sep 17 00:00:00 2001 From: Jake Funke Date: Wed, 12 Oct 2022 12:14:17 -0700 Subject: [PATCH 4/6] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 84be7ed..e9b9a56 100644 --- a/README.md +++ b/README.md @@ -69,3 +69,9 @@ A once-weekly cron on clear_weekly_users.py should be set up to keep weekly visi ## credits * thank you [tilde.town](http://tilde.town/) for inspiration! + +## praise for botany +![Screencap](https://tilde.town/~curiouser/praise1.png) +![Screencap](https://tilde.town/~curiouser/praise2.png) +![Screencap](https://tilde.town/~curiouser/praise3.png) + From c63a186d32b8b29ae0d3b99edc5046059afd8867 Mon Sep 17 00:00:00 2001 From: Tiago Epifanio Date: Sun, 19 Mar 2023 23:51:39 +0000 Subject: [PATCH 5/6] 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 6/6] 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()