Exemple #1
0
def spend_money(user_id, amount):
    if amount <= 0:
        return False
    control = update_account(user_id, amount * -1)
    if not control:
        return False
    spend = Spending(amount,datetime.now(),user_id)
    db.session.add(spend)
    db.session.commit()
    return True
def spend_money (user_id, amount):
    balance = get_balance(user_id)
    print(balance)
    if balance != None and amount <= 0 and amount <= balance:
        return False
    control = update_account (user_id, amount*-1)
    if not control:
        return False
    spend = Spending(amount,datetime.now(),user_id)
    db.session.add(spend)
    db.session.commit()
    return True
Exemple #3
0
def gastar_money (user_id, amount):
    saldo=0
    if amount <= 0:
        return False
    saldo=saldo-amount
    control = update_account (user_id, saldo)
    if not control:
        return False
    spend = Spending(
        amount,
        datetime.now(),
        user_id)
    db.session.add(spend)
    db.session.commit()
    return True