From 3c2212f96c81ec3440c8ad8c9290786cf30327e4 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 23 Dec 2020 12:26:40 +0100 Subject: [PATCH 1/1] Progress bar on payment form page. --- src/club/static/club/club.scss | 1 + src/club/templates/club/membership_form.html | 5 +++++ src/club/templatetags/club.py | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/src/club/static/club/club.scss b/src/club/static/club/club.scss index 4b3d7d50e..892faf4ee 100644 --- a/src/club/static/club/club.scss +++ b/src/club/static/club/club.scss @@ -83,6 +83,7 @@ margin-bottom: 1em; border: 1px solid #ddd; position: relative; + min-height: 100px; } .ambassador.with-photo { padding-right: 145px; diff --git a/src/club/templates/club/membership_form.html b/src/club/templates/club/membership_form.html index f9fe931e3..fe85c1c88 100644 --- a/src/club/templates/club/membership_form.html +++ b/src/club/templates/club/membership_form.html @@ -34,6 +34,11 @@ {% chunk 'club_form_top' %} + {% club_monthly_since '2020-12-01' as cc %} + {% club_monthly_missing_since '2020-12-01' 100 as cm %} +

Pomóż nam zdobyć 100 nowych Przyjaciół do końca roku. W grudniu stałą wpłatą wsparło nas już {{ cc }} czytelników i czytelniczek, brakuje {{ cm }}.

+
 {{ cc }}{{ cm }} 
+ {% include "club/payment_form.html" %} {% chunk 'club_form_bottom' %} diff --git a/src/club/templatetags/club.py b/src/club/templatetags/club.py index 42913fe93..d69129720 100644 --- a/src/club/templatetags/club.py +++ b/src/club/templatetags/club.py @@ -66,3 +66,15 @@ def club_active_30day_sum(): yearly=False, monthly=False, payed_at__gte=now() - timedelta(days=30) ).aggregate(s=Sum('amount'))['s'] or 0 + + +@register.simple_tag +def club_monthly_since(start): + return Schedule.objects.filter( + monthly=True, payed_at__gte=start).count() + + +@register.simple_tag +def club_monthly_missing_since(start, target): + return target - Schedule.objects.filter( + monthly=True, payed_at__gte=start).count() -- 2.20.1