Skip to content

Commit

Permalink
Merge pull request #100 from ethifylabs/clr-normalize-patch
Browse files Browse the repository at this point in the history
Clr normalize Fix Code
  • Loading branch information
Man-Jain authored Jul 2, 2020
2 parents 83dde31 + b5e1de8 commit be9c7da
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions backend/downtownapi/main/clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ def calculate_clr(aggregated_contributions, _cap=8000, total_pot=25000.0):

# 1. normalize
if bigtot >= total_pot:
t['clr_amount'] = ((clr_amount / bigtot) * total_pot)
clr_amount = ((clr_amount / bigtot) * total_pot)

# 2. cap clr amount
if clr_amount >= _cap:
t['clr_amount'] = _cap
clr_amount = _cap

t['clr_amount'] = clr_amount

# 3. calculate the total clr to be distributed
bigtot_normalized_cap += t['clr_amount']
Expand Down Expand Up @@ -150,11 +152,13 @@ def calculate_live_clr(aggregated_contributions, business_id, _cap=8000, total_p

# 1. normalize
if bigtot >= total_pot:
t['clr_amount'] = ((clr_amount / bigtot) * total_pot)
clr_amount = ((clr_amount / bigtot) * total_pot)

# 2. cap clr amount
# 2. cap clr amount
if clr_amount >= _cap:
t['clr_amount'] = _cap
clr_amount = _cap

t['clr_amount'] = clr_amount

# 3. calculate the total clr to be distributed
bigtot_normalized_cap += t['clr_amount']
Expand Down

0 comments on commit be9c7da

Please sign in to comment.