Skip to content

Commit

Permalink
fix(checkouts): report existing checkouts (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
drahamim authored Mar 15, 2024
1 parent 2e2556a commit 921a0a6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/invenflask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,15 @@ def checkout():
).scalar() and accessory_id != '':
flash('Accessory does not exist', "warning")
return render_template('checkout.html')
if db.session.query(Checkout).filter(func.lower(
func.lower(Checkout.assetid)) == accessory_id.lower()).first():
flash('Accessory already checked out no checkouts saved', "warning")
return render_template('checkout.html')

if db.session.query(Checkout).filter(func.lower(
func.lower(Checkout.assetid)) == asset_id.lower()).first():
flash('Asset already checked out no checkouts saved', "warning")
return render_template('checkout.html')

else:
try:
Expand Down

0 comments on commit 921a0a6

Please sign in to comment.