def handle_start_edit_house(): if len(request.user.houses) == 0: house = House(request.user.id) db.session.add(house) db.session.commit() else: house = request.user.houses[-1] return house.format_edit()
def handle_end_edit_house(): ''' Inputs: &died=[0 or 1] &house_map=[house map] &vault_contents=[vault contents] &backpack_contents=[bp contents] &gallery_contents=[gal contents] &price_list=[price list] &purchase_list=[purchase list] &sell_list=[sell list] &self_test_move_list=[move list] &family_exit_paths=[paths] ''' last_house = request.user.houses[-1] # if nothing changed, don't save it val = request.values if val['purchase_list'] == '#' and val['sell_list'] == '#' \ and val['house_map'] == last_house.house_map: return 'OK' # create a new house to save all this house = House(request.user.id, last_house) house.house_map = val['house_map'] house.vault_contents = val['vault_contents'] house.backpack_contents = val['backpack_contents'] house.gallery_contents = val['gallery_contents'] house.must_self_test = 0 db.session.add(house) db.session.commit() return 'OK'
def handle_end_edit_house(): """ Inputs: &died=[0 or 1] &house_map=[house map] &vault_contents=[vault contents] &backpack_contents=[bp contents] &gallery_contents=[gal contents] &price_list=[price list] &purchase_list=[purchase list] &sell_list=[sell list] &self_test_move_list=[move list] &family_exit_paths=[paths] """ last_house = request.user.houses[-1] # if nothing changed, don't save it val = request.values if val["purchase_list"] == "#" and val["sell_list"] == "#" and val["house_map"] == last_house.house_map: return "OK" # create a new house to save all this house = House(request.user.id, last_house) house.house_map = val["house_map"] house.vault_contents = val["vault_contents"] house.backpack_contents = val["backpack_contents"] house.gallery_contents = val["gallery_contents"] house.must_self_test = 0 db.session.add(house) db.session.commit() return "OK"