From 7c520cac11a6da38b7012fbbe968a2b329b85a96 Mon Sep 17 00:00:00 2001 From: Owocki Date: Tue, 14 Jan 2020 09:22:34 -0700 Subject: [PATCH] display voucher fundings in diff category from the regular (actually transfered) fundings --- app/grants/templates/grants/activity.html | 65 +++++--------------- app/grants/templates/grants/transaction.html | 48 +++++++++++++++ app/grants/views.py | 4 +- 3 files changed, 66 insertions(+), 51 deletions(-) create mode 100644 app/grants/templates/grants/transaction.html diff --git a/app/grants/templates/grants/activity.html b/app/grants/templates/grants/activity.html index 7d12854110e..db5e684ad02 100644 --- a/app/grants/templates/grants/activity.html +++ b/app/grants/templates/grants/activity.html @@ -5,7 +5,7 @@ {% if subscriptions %}

- {% trans "Active Subscriptions" %} + {% trans "Active Subscriptions" %} ({{subscriptions|length}})

{% for subscription in subscriptions %}
@@ -56,56 +56,21 @@

- {% trans "Contributions" %} + {% trans "Contributions" %} ({{contributions|length}})

{% for transaction in contributions %} -
-
- {{ transaction.created_on|date:"d M Y" }} -
-
- - - -
-
- -
- {{ transaction.subscription.amount_per_period|floatformat:4|intcomma }} {{ transaction.subscription.token_symbol }} - {% if not transaction.tx_cleared %} (Pending) {% endif %} - {% if not transaction.success %} (Failed) {% endif %} -
-
- {% if not transaction.subscription.contributor_profile.hide_wallet_address %} - - {% endif %} -
-
-

- {{ transaction.subscription.amount_per_period|floatformat:4|intcomma }} - {{ transaction.subscription.token_symbol }} -

-
- {% if transaction.value_in_usdt_now %} -
-

- {{ transaction.value_in_usdt_now }} - USD -

-
- {% endif %} -
-
+ {% include 'grants/transaction.html' %} + {% endfor %} +
+ {% endif %} + {% if voucher_fundings %} +
+
+

+ {% trans "Voucher Fundings" %} ({{voucher_fundings|length}}) +

+ {% for transaction in voucher_fundings %} + {% include 'grants/transaction.html' %} {% endfor %}
{% endif %} @@ -113,7 +78,7 @@

- {% trans "Inactive Subscriptions" %} + {% trans "Inactive Subscriptions" %} ({{cancelled_subscriptions|length}})

{% for subscription in cancelled_subscriptions %}
diff --git a/app/grants/templates/grants/transaction.html b/app/grants/templates/grants/transaction.html new file mode 100644 index 00000000000..75744545e69 --- /dev/null +++ b/app/grants/templates/grants/transaction.html @@ -0,0 +1,48 @@ +{% load static humanize i18n grants_extra %} +
+
+ {{ transaction.created_on|date:"d M Y" }} +
+
+ + + +
+
+ +
+ {{ transaction.subscription.amount_per_period|floatformat:4|intcomma }} {{ transaction.subscription.token_symbol }} + {% if not transaction.tx_cleared %} (Pending) {% endif %} + {% if not transaction.success %} (Failed) {% endif %} +
+
+ {% if not transaction.subscription.contributor_profile.hide_wallet_address %} + + {% endif %} +
+
+

+ {{ transaction.subscription.amount_per_period|floatformat:4|intcomma }} + {{ transaction.subscription.token_symbol }} +

+
+ {% if transaction.value_in_usdt_now %} +
+

+ {{ transaction.value_in_usdt_now }} + USD +

+
+ {% endif %} +
+
\ No newline at end of file diff --git a/app/grants/views.py b/app/grants/views.py index 954b878f3dd..7ab9063c0c6 100644 --- a/app/grants/views.py +++ b/app/grants/views.py @@ -218,7 +218,8 @@ def grant_details(request, grant_id, grant_slug): cancelled_subscriptions = grant.subscriptions.filter(active=False, error=False).order_by('-created_on') _contributions = Contribution.objects.filter(subscription__in=grant.subscriptions.all()) phantom_funds = grant.phantom_funding.all() - contributions = list(_contributions.order_by('-created_on')) + [ele.to_mock_contribution() for ele in phantom_funds.order_by('-created_on')] + contributions = list(_contributions.order_by('-created_on')) + voucher_fundings = [ele.to_mock_contribution() for ele in phantom_funds.order_by('-created_on')] contributors = list(_contributions.distinct('subscription__contributor_profile')) + list(phantom_funds.distinct('profile')) activity_count = len(cancelled_subscriptions) + len(contributions) user_subscription = grant.subscriptions.filter(contributor_profile=profile, active=True).first() @@ -298,6 +299,7 @@ def grant_details(request, grant_id, grant_slug): 'contributors': contributors, 'clr_active': clr_active, 'is_team_member': is_team_member, + 'voucher_fundings': voucher_fundings, } if tab == 'stats':