Skip to content

Commit

Permalink
GITC-124: Ensures each profile_for_clr exists before including the co…
Browse files Browse the repository at this point in the history
…ntribution in the calc (#9240)
  • Loading branch information
gdixon authored Jul 1, 2021
1 parent 0e2f669 commit 557c8e6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/grants/clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def calculate_clr(aggregated_contributions, pair_totals, trust_dict, v_threshold
{user_id (str): {user_id (str): pair_total (float)}}
trust_dict
{user_id (str): trust_score (float)}
v_threshold
v_threshold
float
uv_threshold
float
Expand Down Expand Up @@ -360,11 +360,12 @@ def populate_data_for_clr(grants, contributions, clr_round):
contributions_by_id = {}
for c in contribs:
prof = c.profile_for_clr
key = prof.id
if key not in contributions_by_id.keys():
contributions_by_id[key] = []
contributions_by_id[key].append(c)
contributing_profile_ids.append((prof.id, prof.trust_bonus))
if prof:
key = prof.id
if key not in contributions_by_id.keys():
contributions_by_id[key] = []
contributions_by_id[key].append(c)
contributing_profile_ids.append((prof.id, prof.trust_bonus))

contributing_profile_ids = list(set(contributing_profile_ids))

Expand Down

0 comments on commit 557c8e6

Please sign in to comment.