From ba5339d8bd05118f4c6a8fa2735f30d9b20a6f13 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Fri, 18 Nov 2022 23:34:57 +0200 Subject: [PATCH] ui: Add sent offer status filter. --- basicswap/basicswap.py | 8 ++++++++ basicswap/templates/offers.html | 22 +++++++++++++++++++++- basicswap/ui/page_offers.py | 6 ++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 4e0dbcb..8771c75 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -5697,6 +5697,14 @@ class BasicSwap(BaseApp): if sent: q = q.filter(Offer.was_sent == True) # noqa: E712 + + active_state = filters.get('active', 'any') + if active_state == 'active': + q = q.filter(Offer.expire_at > now, Offer.active_ind == 1) + elif active_state == 'expired': + q = q.filter(Offer.expire_at <= now) + elif active_state == 'revoked': + q = q.filter(Offer.active_ind != 1) else: q = q.filter(sa.and_(Offer.expire_at > now, Offer.active_ind == 1)) diff --git a/basicswap/templates/offers.html b/basicswap/templates/offers.html index 1e7c0e5..d3f6ecc 100644 --- a/basicswap/templates/offers.html +++ b/basicswap/templates/offers.html @@ -36,7 +36,7 @@

{{ page_type }}

{{ page_type_description }}

-
+
+ {% if sent_offers %} +
+
+

State:

+
+
+
+
+ + + + +
+
+ {% endif %}