From 027964192a6592419ebbb9fefde83deae6bf6dad Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Sun, 8 Mar 2015 21:21:58 -0700 Subject: [PATCH] Function to compute how far to the goal we are. This is also inserted by the Javascript code as well, but no reason we can't compute it server side, too. --- www/conservancy/apps/fundgoal/models.py | 3 +++ www/conservancy/static/npoacct/index.html | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/www/conservancy/apps/fundgoal/models.py b/www/conservancy/apps/fundgoal/models.py index 69020f60..1ec83d65 100644 --- a/www/conservancy/apps/fundgoal/models.py +++ b/www/conservancy/apps/fundgoal/models.py @@ -10,5 +10,8 @@ class FundraisingGoal(models.Model): def __unicode__(self): return self.fundraiser_code_name + def percentage_there(self): + return (fundraiser_so_far_amount / fundraiser_goal_amount ) * 100.00 + class Meta: ordering = ('fundraiser_code_name',) diff --git a/www/conservancy/static/npoacct/index.html b/www/conservancy/static/npoacct/index.html index 7519f3b2..83c5b4fc 100644 --- a/www/conservancy/static/npoacct/index.html +++ b/www/conservancy/static/npoacct/index.html @@ -136,9 +136,10 @@ el.attachEvent('on'+ev, function() {handler.apply(el);}); */ --> -${{ fundgoal.fundraiser_so_far_amount|floatformat:2|intcomma }} raised toward
-our ${{ fundgoal.fundraiser_goal_amount|floatformat:2|intcomma }} goal.
-
88.4%
+${{ fundgoal.fundraiser_so_far_amount|floatformat:0|intcomma }} raised toward
+our ${{ fundgoal.fundraiser_goal_amount|floatformat:0|intcomma }} goal.
+
{{ fundgoal.percentage_there|floatformat:1 }}%

(Progress bar updated monthly.)

Help us reach our goal: