Block user from visiting self, fix guest watering bug
parent
e6e8778dfb
commit
b9ef7c31bb
|
@ -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
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
Loading…
Reference in New Issue