Skip to content

bug: ignore grant removed from round in clr calculation #9876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/grants/clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import numpy as np
from grants.clr_data_src import fetch_contributions, fetch_grants, fetch_summed_contributions
from grants.models import GrantCLRCalculation


def populate_data_for_clr(grants, contributions, clr_round):
Expand Down Expand Up @@ -485,7 +486,11 @@ def predict_clr(save_to_db=False, from_date=None, clr_round=None, network='mainn
print(f"- starting grants iter at {round(time.time(),1)}")
# for full calc - calculate the clr for each grant given additional potential_donations
total_count = grants.count()

invalid_clr_calculations = GrantCLRCalculation.objects.filter(latest=True, grantclr=clr_round.pk)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice approach here!! 🚀


for grant in grants:
invalid_clr_calculations.exclude(grant=grant.pk)
# five potential additional donations plus the base case of 0
potential_donations = [0, 1, 10, 100, 1000, 10000]

Expand Down Expand Up @@ -545,6 +550,8 @@ def predict_clr(save_to_db=False, from_date=None, clr_round=None, network='mainn

debug_output.append({'grant': grant.id, "title": grant.title, "clr_prediction_curve": (potential_donations, potential_clr), "grants_clr": grants_clr})

invalid_clr_calculations.update(latest=False, active=False)

print(f"\nTotal execution time: {(timezone.now() - clr_calc_start_time)}\n")

return debug_output