From b9ef7c31bb403adb24466edeeca80c6cf6528855 Mon Sep 17 00:00:00 2001 From: Jake Funke Date: Mon, 12 Mar 2018 14:35:42 -0700 Subject: [PATCH] Block user from visiting self, fix guest watering bug --- botany.py | 7 +++++-- menu_screen.py | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/botany.py b/botany.py index e7587bb..6432358 100755 --- a/botany.py +++ b/botany.py @@ -248,10 +248,13 @@ class Plant(object): def water_check(self): latest_visitor_timestamp = self.guest_check() if latest_visitor_timestamp > self.watered_timestamp: - self.watered_timestamp = latest_visitor_timestamp + visitor_delta_watered = latest_visitor_timestamp - self.watered_timestamp + if visitor_delta_watered <= (5 * (24 * 3600)): + self.watered_timestamp = latest_visitor_timestamp self.time_delta_watered = int(time.time()) - self.watered_timestamp if self.time_delta_watered <= (24 * 3600): - self.watered_24h = True + if not self.watered_24h: + self.watered_24h = True return True else: self.watered_24h = False diff --git a/menu_screen.py b/menu_screen.py index d01d0f9..d23ac0b 100644 --- a/menu_screen.py +++ b/menu_screen.py @@ -600,6 +600,11 @@ class CursedMenu(object): if not guest_garden: self.clear_info_pane() return None + if guest_garden.lower() == getpass.getuser().lower(): + self.screen.addstr(16, 2, "you're already here!") + self.screen.getch() + self.clear_info_pane() + return None home_folder = os.path.dirname(os.path.expanduser("~")) guest_json = home_folder + "/{}/.botany/{}_plant_data.json".format(guest_garden, guest_garden) guest_plant_description = ""