From 0f5a0926e2a5388029ae6eb4b00de8c47a6510c7 Mon Sep 17 00:00:00 2001
From: = <=>
Date: Fri, 18 Oct 2024 00:54:10 +0000
Subject: [PATCH] fix #241
---
auctions/views.py | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/auctions/views.py b/auctions/views.py
index 35fff70..197fa91 100755
--- a/auctions/views.py
+++ b/auctions/views.py
@@ -4161,17 +4161,17 @@ def tos_check(request, auction, routeByLastAuction):
# if not, check and see if the user has been participating in an auction
try:
auction = UserData.objects.get(user=request.user).last_auction_used
- if timezone.now() > auction.date_end:
- try:
- invoice = Invoice.objects.get(auctiontos_user__user=request.user, auction=auction)
- messages.info(
- request,
- f'{auction} has ended. View your invoice, leave feedback on lots you bought or sold, or view lots',
- )
- return redirect("/lots/")
- except:
- pass
- auction = None
+ invoice = (
+ Invoice.objects.filter(auctiontos_user__user=request.user, auctiontos_user__auction=auction)
+ .exclude(status="DRAFT")
+ .first()
+ )
+ if invoice:
+ messages.info(
+ request,
+ f'{auction} has ended. View your invoice or leave feedback on lots you bought or sold',
+ )
+ return redirect("/lots/")
else:
try:
# in progress online auctions get routed