-
-
Notifications
You must be signed in to change notification settings - Fork 774
refactor of grantclr to make the round_num an actual int + add a subround/customer field #7685
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
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c6f8cce
WIP refactor
owocki 2dae832
linter
owocki f580450
adds customer field
owocki b142639
fix: help texts in model fields
chibie b85698f
fix(views): sub_round_slug default should be 'all'
chibie 648934f
attempt at frontend todos
chibie 18d7f07
feat: make customer_name & sub_round_slug optional
chibie 581fcbe
feat: more params to clr_grants view and /clr urls
chibie 639be2d
feat: implement new clr params in frontend
chibie b041440
feat: new migration
chibie e5c666d
feat: add new clr params in card info
chibie d739766
Merge branch 'grants-round-8' into kevin/grants_clr_refactor
chibie f96ca50
update pledge grant creation
chibie 7fdeb0a
merge migrations
chibie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 2.2.4 on 2020-10-15 19:33 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('grants', '0089_contribution_checkout_type'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='grantclr', | ||
name='customer_name', | ||
field=models.CharField(default='all', help_text='Customer Name', max_length=255), | ||
), | ||
migrations.AddField( | ||
model_name='grantclr', | ||
name='sub_round_slug', | ||
field=models.CharField(default='all', help_text='Sub Round Slug', max_length=255), | ||
), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 2.2.4 on 2020-10-15 19:33 | ||
|
||
from django.db import migrations | ||
|
||
def forwards(apps, schema_editor): | ||
GrantCLR = apps.get_model('grants', 'GrantCLR') | ||
for gclr in GrantCLR.objects.exclude(round_num__lt=9): | ||
gclr.sub_round_slug = gclr.round_num | ||
gclr.round_num = 7 | ||
gclr.save() | ||
for gclr in GrantCLR.objects.all(): | ||
gclr.customer_name = "ethereum" | ||
gclr.save() | ||
|
||
|
||
def backwards(apps, schema_editor): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('grants', '0090_grantclr_sub_round_slug'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(forwards, backwards), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.2.4 on 2020-10-15 19:48 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('grants', '0091_auto_20201015_1933'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='grantclr', | ||
name='round_num', | ||
field=models.PositiveIntegerField(help_text='CLR Round Number'), | ||
), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Generated by Django 2.2.4 on 2020-11-13 01:24 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('grants', '0092_auto_20201015_1948'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='grantclr', | ||
name='customer_name', | ||
field=models.CharField(blank=True, default='', help_text='CLR Customer Name', max_length=15), | ||
), | ||
migrations.AlterField( | ||
model_name='grantclr', | ||
name='end_date', | ||
field=models.DateTimeField(help_text='CLR Round End Date'), | ||
), | ||
migrations.AlterField( | ||
model_name='grantclr', | ||
name='sub_round_slug', | ||
field=models.CharField(blank=True, default='', help_text='Sub Round Slug', max_length=25), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='grantclr', | ||
unique_together={('customer_name', 'round_num', 'sub_round_slug')}, | ||
), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by Django 2.2.4 on 2020-11-19 19:21 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('grants', '0093_auto_20201113_0124'), | ||
('grants', '0095_auto_20201119_1031'), | ||
] | ||
|
F438
||
operations = [ | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -491,11 +491,16 @@ def bulk_grants_for_cart(request): | |
return JsonResponse({'grants': grants}) | ||
|
||
|
||
def clr_grants(request, round_num): | ||
def clr_grants(request, round_num, sub_round_slug='', customer_name=''): | ||
"""CLR grants explorer.""" | ||
|
||
try: | ||
clr_round = GrantCLR.objects.get(round_num__icontains=round_num) | ||
params = { | ||
'round_num': round_num, | ||
'sub_round_slug': sub_round_slug, | ||
'customer_name': customer_name | ||
} | ||
clr_round = GrantCLR.objects.get(**params) | ||
|
||
except GrantCLR.DoesNotExist: | ||
return redirect('/grants') | ||
|
@@ -540,11 +545,18 @@ def get_grants(request): | |
featured = request.GET.get('featured', '') == 'true' | ||
collection_id = request.GET.get('collection_id', '') | ||
round_num = request.GET.get('round_num', None) | ||
sub_round_slug = request.GET.get('sub_round_slug', '') | ||
customer_name = request.GET.get('customer_name', '') | ||
|
||
clr_round = None | ||
try: | ||
if round_num: | ||
clr_round = GrantCLR.objects.get(round_num=round_num) | ||
params = { | ||
'round_num': round_num, | ||
'sub_round_slug': sub_round_slug, | ||
'customer_name': customer_name | ||
} | ||
clr_round = GrantCLR.objects.get(**params) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chibie love me some **splat! |
||
except GrantCLR.DoesNotExist: | ||
pass | ||
|
||
|
@@ -2385,6 +2397,7 @@ def record_subscription_activity_helper(activity_type, subscription, profile, an | |
} | ||
return Activity.objects.create(**kwargs) | ||
|
||
|
||
def record_grant_activity_helper(activity_type, grant, profile, amount=None, token=None): | ||
"""Registers a new activity concerning a grant | ||
|
||
|
@@ -2451,7 +2464,6 @@ def new_matching_partner(request): | |
return TemplateResponse(request, 'grants/new_match.html', params) | ||
|
||
|
||
|
||
def create_matching_pledge_v1(request): | ||
|
||
response = { | ||
|
@@ -2466,7 +2478,6 @@ def create_matching_pledge_v1(request): | |
|
||
profile = request.user.profile if hasattr(request.user, 'profile') else None | ||
|
||
|
||
if not profile: | ||
response['message'] = 'error: no matching profile found' | ||
return JsonResponse(response) | ||
|
@@ -2475,7 +2486,6 @@ def create_matching_pledge_v1(request): | |
response['message'] = 'error: pledge creation is a POST operation' | ||
return JsonResponse(response) | ||
|
||
|
||
grant_types = request.POST.get('grant_types[]', None) | ||
grant_categories = request.POST.get('grant_categories[]', None) | ||
grant_collections = request.POST.get('grant_collections[]', None) | ||
|
@@ -2491,7 +2501,6 @@ def create_matching_pledge_v1(request): | |
response['message'] = 'error: grant_types / grant_collections is parameter' | ||
return JsonResponse(response) | ||
|
||
|
||
matching_pledge_stage = request.POST.get('matching_pledge_stage', None) | ||
tx_id = request.POST.get('tx_id', None) | ||
if matching_pledge_stage == 'ready' and not tx_id: | ||
|
@@ -2518,7 +2527,8 @@ def create_matching_pledge_v1(request): | |
} | ||
|
||
clr_round = GrantCLR.objects.create( | ||
round_num='pledge', | ||
round_num=0, | ||
sub_round_slug='pledge', | ||
start_date=timezone.now(), | ||
end_date=timezone.now(), | ||
total_pot=amount, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would you have round num and slug ?
Is this to group all the clr for round 8 under clr/8/...?
For custom CLR like matic / zcash
I'm not sure if this makes sense
I'd lean towards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
round num = 7
slug = community, infra tech, or dapp tech
there can be multiple slugs in the same round.