def update_user(id): first_name = request.form["first_name"] last_name = request.form["last_name"] email = request.form["email"] wallet = float(request.form["wallet"]) user = User(first_name, last_name, email, wallet, id) user_repository.update(user) return redirect("/users")
def update_budget(id): user = user_repository.select(id) name = user.name budget = request.form["budget"] updated_user = User(name, budget, id) user_repository.update(updated_user) users = user_repository.select_all() budget_total = 0 for user in users: budget_total += user.budget return render_template("/budgets/index.html", users=users, budget_total=budget_total)
def deliver(order_id): order = order_repository.get_order(order_id) is_favour = order.type == Order.FAVOR_TYPE user_repository.increment_deliveries_completed(str(order.owner.id)) user_repository.increment_deliveries_completed(str(order.delivery.id)) delivery_service.handle_status_change(order.delivery.id, Order.DELIVERED_STATUS, is_favour) delivery_service.complete_order(order) user_service.confirm_favor_order(order) user_repository.update(order.delivery.id, {'balance': order.quotation * DELIVERY_PERCENTAGE}) return order_repository.update(order_id, { 'status': Order.DELIVERED_STATUS, 'completed_date': datetime.now() })
def update_user_spending_limit(id): name = request.form['name'] spending_limit = request.form['spending_limit'] user = User(name, spending_limit, id) user_repository.update(user) return redirect("/transactions")
def update_user(id): name = request.form["name"] user = Users(name, id) user_repository.update(user)
# task_1 = Task("Walk Dog", "Jack Jarvis", 60) # print(task_1.__dict__) # task_repository.save(task_1) # task_2 = Task("Feed Cat", "Victor McDade", 5) # task_repository.save(task_2) # # res = task_repository.select_all() # # for task in res: # # print(task.__dict__) # found_task = task_repository.select(1).__dict__ # task_1.mark_complete() # task_repository.update() task_repository.delete_all() user_repository.delete_all() user_2 = User('Halle', 'Berry') user_repository.save(user_2) user_1 = User('Maddie', 'Wood') user_repository.save(user_1) user_repository.select_all() user_repository.update(user_2) user_repository.select_all() task = Task("Walk Dog", user_2, 10) task_repository.save(task) pdb.set_trace()
def update_user(id): name = request.form["name"] budget = request.form["budget"] user = User(name, budget, id) user_repository.update(user) return redirect("/users/dashboard.html")
def update_user(id): name = request.form["username"] updated_user = User(name, id) user_repository.update(updated_user) return redirect("/")