Skip to content

Commit

Permalink
adds contribution multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Sep 18, 2020
1 parent 260e908 commit b51fa7f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/grants/clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def populate_data_for_clr(grants, contributions, phantom_funding_profiles, clr_r
if len(contributing_profile_ids) > 0:
for profile_id in contributing_profile_ids:
profile_contributions = contribs.filter(profile_for_clr_id=profile_id)
sum_of_each_profiles_contributions = float(sum([c.subscription.amount_per_period_usdt for c in profile_contributions if c.subscription.amount_per_period_usdt]))
sum_of_each_profiles_contributions = float(sum([c.subscription.amount_per_period_usdt * clr_round.contribution_multiplier for c in profile_contributions if c.subscription.amount_per_period_usdt]))
phantom_funding = grant_phantom_funding_contributions.filter(profile_id=profile_id)
if phantom_funding.exists():
sum_of_each_profiles_contributions = sum_of_each_profiles_contributions + phantom_funding.first().value
Expand Down
18 changes: 18 additions & 0 deletions app/grants/migrations/0085_grantclr_contribution_multiplier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2020-09-18 16:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('grants', '0084_auto_20200917_1631'),
]

operations = [
migrations.AddField(
model_name='grantclr',
name='contribution_multiplier',
field=models.DecimalField(decimal_places=4, default=1.0, help_text='A contribution multipler to be applied to each contribution', max_digits=10),
),
]
7 changes: 7 additions & 0 deletions app/grants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ class GrantCLR(SuperModel):
decimal_places=2,
max_digits=10
)
contribution_multiplier = models.DecimalField(
help_text="A contribution multipler to be applied to each contribution",
default=1.0,
decimal_places=4,
max_digits=10,
)

logo = models.ImageField(
upload_to=get_upload_filename,
null=True,
Expand Down

0 comments on commit b51fa7f

Please sign in to comment.