mirror of
https://github.com/erpnext/foundation.git
synced 2026-10-16 18:00:47 +02:00
Merge pull request #39 from netchampfaris/bounty-system
Show only paid backers
This commit is contained in:
@@ -11,7 +11,7 @@ from frappe.website.utils import get_comment_list
|
||||
|
||||
class Bounty(WebsiteGenerator):
|
||||
def get_context(self, context):
|
||||
paid_backers = [backer for backer in self.bounty_backer if backer.paid]
|
||||
paid_backers = get_paid_backers(self.bounty_backer)
|
||||
no_of_backers = len(paid_backers)
|
||||
if no_of_backers == 0:
|
||||
no_of_backers = 'Be the first to back this bounty'
|
||||
@@ -37,12 +37,11 @@ class Bounty(WebsiteGenerator):
|
||||
from frappe.utils.user import get_user_fullname
|
||||
|
||||
self.bounty_collected = 0.0
|
||||
for backer in self.bounty_backer:
|
||||
if backer.paid:
|
||||
amount = backer.amount
|
||||
if backer.currency == 'INR':
|
||||
amount = backer.amount / 65.00
|
||||
self.bounty_collected += amount
|
||||
for backer in get_paid_backers(self.bounty_backer):
|
||||
amount = backer.amount
|
||||
if backer.currency == 'INR':
|
||||
amount = backer.amount / 65.00
|
||||
self.bounty_collected += amount
|
||||
|
||||
if not self.route:
|
||||
self.published = 1
|
||||
@@ -62,4 +61,8 @@ def get_list_context(context):
|
||||
context.no_breadcrumbs = True
|
||||
context.order_by = 'creation desc'
|
||||
context.introduction = '<a href="new-bounty" class="btn btn-primary">Start a new Bounty</a>'
|
||||
context.fmt_money = fmt_money
|
||||
context.fmt_money = fmt_money
|
||||
context.get_paid_backers = get_paid_backers
|
||||
|
||||
def get_paid_backers(backers):
|
||||
return [backer for backer in backers if backer.paid]
|
||||
@@ -12,10 +12,11 @@
|
||||
<p>
|
||||
<span class="label">{{ fmt_money(doc.goal, currency="USD") }}</span>
|
||||
<span class="label">Ends on {{ doc.end_date }}</span>
|
||||
{% if doc.bounty_backer %}
|
||||
{% set paid_backers = get_paid_backers(doc.bounty_backer) %}
|
||||
{% if paid_backers|len > 0 %}
|
||||
<span class="label">
|
||||
{{ doc.bounty_backer|len }}
|
||||
{% if doc.bounty_backer|len > 1 %}
|
||||
{{ paid_backers|len }}
|
||||
{% if paid_backers|len > 1 %}
|
||||
Backers
|
||||
{% else %}
|
||||
Backer
|
||||
|
||||
Reference in New Issue
Block a user