Merge pull request #50 from epif4nio/master

On harvest confirmation message, default to Y when user presses enter
pull/35/head^2
Jake Funke 2023-03-21 10:47:44 -07:00 committed by GitHub
commit 070a880f12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -508,8 +508,6 @@ class DataManager(object):
def update_garden_db(self, this_plant): def update_garden_db(self, this_plant):
# insert or update this plant id's entry in DB # 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.init_database()
self.migrate_database() self.migrate_database()
age_formatted = self.plant_age_convert(this_plant) age_formatted = self.plant_age_convert(this_plant)
@ -528,6 +526,13 @@ class DataManager(object):
psco = str(this_plant.ticks), psco = str(this_plant.ticks),
pdead = int(this_plant.dead)) pdead = int(this_plant.dead))
c.execute(update_query) 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.commit()
conn.close() conn.close()

View File

@ -633,7 +633,7 @@ class CursedMenu(object):
if user_in == -1: # Input comes from pipe/file and is closed if user_in == -1: # Input comes from pipe/file and is closed
raise IOError raise IOError
if user_in in [ord('Y'), ord('y')]: if user_in in [ord('Y'), ord('y'), 10]:
self.plant.start_over() self.plant.start_over()
else: else:
pass pass