From 792d13ac2f8fe0165e24acd3484fe3f79c6bcdf5 Mon Sep 17 00:00:00 2001 From: Eddy Harrington Date: Thu, 21 May 2020 09:24:29 -0700 Subject: [PATCH] small refactor --- templates/budgets.html | 1 - tendie_account.py | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/templates/budgets.html b/templates/budgets.html index e0b9554..2e920ab 100644 --- a/templates/budgets.html +++ b/templates/budgets.html @@ -23,7 +23,6 @@
Create a new budget
Create a Budget {% else %}

All of your income is budgeted for. Good job 👍

- Create a Budget {% endif %} diff --git a/tendie_account.py b/tendie_account.py index e6b64fb..0600248 100644 --- a/tendie_account.py +++ b/tendie_account.py @@ -64,13 +64,11 @@ def addPayer(name, userID): return {"apology": "You already have a payer with that name. Enter a new, unique name."} else: # Insert new payer into DB - db.execute("INSERT INTO payers (user_id, name) VALUES (:usersID, :name)", - {"usersID": userID, "name": name}) + row = db.execute("INSERT INTO payers (user_id, name) VALUES (:usersID, :name)", + {"usersID": userID, "name": name}).rowcount db.commit() - # TODO lazy fix to make the return type consistent with rename/delete payer and updateincome. - # These functions return the # of rows updated/deleted (always being 1) whereas this one is using INSERT and returns the PK value. For now just return the value of 1 as a workaround. - # TODO Fix: use 'db.execute('sql statement').rowcount' to get row number here - return 1 + + return row # Rename a users existing payer