Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyharrington committed May 21, 2020
1 parent 0e9f7e4 commit 792d13a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion templates/budgets.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ <h5 class="card-title">Create a new budget</h5>
<a href="/createbudget" class="btn btn-success">Create a Budget</a>
{% else %}
<p>All of your income is budgeted for. Good job 👍</p>
<a href="/createbudget" class="btn btn-success">Create a Budget</a>
{% endif %}
</div>
</div>
Expand Down
10 changes: 4 additions & 6 deletions tendie_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 792d13a

Please sign in to comment.