Skip to content

Commit aeec48b

Browse files
committed
adds a few more round infos
1 parent 5903a24 commit aeec48b

File tree

2 files changed

+143
-0
lines changed

2 files changed

+143
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
select
2+
profile_id,
3+
join_date,
4+
github_created_at,
5+
REGEXP_REPLACE(first_name, '.', 'x', 'g') as first_name,
6+
REGEXP_REPLACE(last_name, '.', 'x', 'g') as last_name,
7+
REGEXP_REPLACE(email, '.', 'x', 'g') as email,
8+
REGEXP_REPLACE(handle, '.', 'x', 'g') as handle,
9+
sms_verification,
10+
persona,
11+
rank_coder,
12+
rank_funder,
13+
num_hacks_joined,
14+
which_hacks_joined,
15+
hack_work_starts,
16+
hack_work_submits,
17+
hack_work_start_orgs,
18+
hack_work_submit_orgs,
19+
bounty_work_starts,
20+
bounty_work_submits,
21+
hack_started_feature,
22+
hack_started_code_review,
23+
hack_started_security,
24+
hack_started_design,
25+
hack_started_documentation,
26+
hack_started_bug,
27+
hack_started_other,
28+
hack_started_improvement,
29+
started_feature,
30+
started_code_review,
31+
started_security,
32+
started_design,
33+
started_documentation,
34+
started_bug,
35+
started_other,
36+
started_improvement,
37+
submitted_feature,
38+
submitted_code_review,
39+
submitted_security,
40+
submitted_design,
41+
submitted_documentation,
42+
submitted_bug,
43+
submitted_other,
44+
submitted_improvement,
45+
bounty_earnings,
46+
bounty_work_start_orgs,
47+
bounty_work_submit_orgs,
48+
kudos_sends,
49+
kudos_receives,
50+
hack_winner_kudos_received,
51+
grants_opened,
52+
grant_contributed,
53+
grant_contributions,
54+
grant_contribution_amount,
55+
num_actions,
56+
action_points,
57+
avg_points_per_action,
58+
last_action_on,
59+
keywords,
60+
activity_level,
61+
reliability,
62+
average_rating,
63+
longest_streak,
64+
earnings_count,
65+
follower_count,
66+
following_count,
67+
num_repeated_relationships,
68+
verification_status
69+
from dashboard_userdirectory limit 1;

scripts/debug/backfill_match_info.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
from grants.models import *
2+
from grants.views import clr_round as round_num
3+
from django.utils import timezone
4+
from django.db.models import Count
5+
6+
7+
def round_num_to_dates(round_id):
8+
start = timezone.now()
9+
end = timezone.now()
10+
amount = 9
11+
if round_id == 1:
12+
start = timezone.datetime(2019, 2, 1)
13+
end = timezone.datetime(2019, 2, 15)
14+
amount = 25000
15+
if round_id == 2:
16+
start = timezone.datetime(2019, 3, 26)
17+
end = timezone.datetime(2019, 4, 19)
18+
amount = 50000
19+
if round_id == 3:
20+
start = timezone.datetime(2019, 9, 15)
21+
end = timezone.datetime(2019, 10, 4)
22+
amount = 100000
23+
if round_id == 4:
24+
start = timezone.datetime(2020, 1, 6)
25+
end = timezone.datetime(2020, 1, 21)
26+
amount = 200000
27+
if round_id == 5:
28+
start = timezone.datetime(2020, 3, 23)
29+
end = timezone.datetime(2020, 4, 5)
30+
amount = 250000
31+
if round_id == 6:
32+
start = timezone.datetime(2020, 6, 16)
33+
end = timezone.datetime(2020, 7, 3)
34+
amount = 175000
35+
if round_id == 7:
36+
start = timezone.datetime(2020, 9, 15)
37+
end = timezone.datetime(2020, 10, 3)
38+
amount = 120 * 3 * 1000
39+
return start, end, amount
40+
41+
for i in range(1, 6):
42+
skip = GrantCLR.objects.filter(round_num=i).exists()
43+
if not skip:
44+
start, end, amount = round_num_to_dates(i)
45+
GrantCLR.objects.create(
46+
round_num=i,
47+
start_date=start,
48+
end_date=end,
49+
total_pot=amount,
50+
)
51+
52+
from_handles = ['owocki', 'vs77bb', 'ceresstation', 'gitcoinbot', 'gitcoingranterog']
53+
for i in range(3, 5):
54+
start, end, amount = round_num_to_dates(i)
55+
payout_range = (end, end + timezone.timedelta(weeks=4))
56+
_contribs = Contribution.objects.filter(created_on__gt=payout_range[0], created_on__lt=payout_range[1])
57+
contribs = Contribution.objects.filter(subscription__contributor_profile__handle__in=from_handles, created_on__gt=payout_range[0], created_on__lt=payout_range[1])
58+
for contrib in contribs:
59+
CLRMatch.objects.create(
60+
round_number=i,
61+
amount=contrib.subscription.amount_per_period_usdt,
62+
grant=contrib.subscription.grant,
63+
ready_for_payout=True,
64+
payout_tx=contrib.tx_id,
65+
payout_tx_date=contrib.created_on,
66+
payout_contribution=contrib,
67+
comments='retroactive payout created by backfill_match_info.py'
68+
)
69+
#__sum = sum(_contribs.values_list('subscription__amount_per_period_usdt', flat=True))
70+
#_sum = sum(contribs.values_list('subscription__amount_per_period_usdt', flat=True))
71+
#print(_contribs.values_list('subscription__contributor_profile__handle').annotate(Count("id")).order_by('-id__count'))
72+
#print(i, _contribs.count(), contribs.count(), __sum, _sum)
73+
74+

0 commit comments

Comments
 (0)