quantize proposal funded property

This commit is contained in:
Aaron 2019-04-16 15:08:13 -05:00
parent df4d892d3b
commit 99af39ed87
No known key found for this signature in database
GPG Key ID: 3B5B7597106F0A0E
1 changed files with 3 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import datetime
from decimal import Decimal
from decimal import Decimal, ROUND_DOWN
from functools import reduce
from flask import current_app
@ -611,7 +611,6 @@ class Proposal(db.Model):
@hybrid_property
def funded(self):
target = Decimal(self.target)
# apply matching multiplier
funded = Decimal(self.contributed) * Decimal(1 + self.contribution_matching)
@ -620,9 +619,9 @@ class Proposal(db.Model):
funded = funded + Decimal(self.contribution_bounty)
# if funded > target, just set as target
if funded > target:
return str(target)
return str(target.quantize(Decimal('.001'), rounding=ROUND_DOWN))
return str(funded)
return str(funded.quantize(Decimal('.001'), rounding=ROUND_DOWN))
@hybrid_property
def is_staked(self):