Skip to content
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

clr: update estimate_clr command to query by grant type #5639

Merged
merged 2 commits into from
Dec 16, 2019

Conversation

thelostone-mc
Copy link
Member

Description
  • estimate_clr.py -> new arguments clr_type, network
  • clr logic updated to query grants by network + grant_type + not hidden
  • grant str updated to also print grant_type
  • crontab updated to run both clr for media and tech grants
Refers/Fixes

Gets in after #5637

Testing

Screenshot 2019-12-15 at 2 57 30 PM

@codecov
Copy link

codecov bot commented Dec 15, 2019

Codecov Report

Merging #5639 into master will increase coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5639      +/-   ##
==========================================
+ Coverage   30.07%   30.08%   +0.01%     
==========================================
  Files         248      248              
  Lines       21395    21404       +9     
  Branches     3103     3105       +2     
==========================================
+ Hits         6434     6440       +6     
- Misses      14685    14688       +3     
  Partials      276      276
Impacted Files Coverage Δ
app/grants/management/commands/estimate_clr.py 0% <0%> (ø) ⬆️
app/grants/clr.py 0% <0%> (ø) ⬆️
app/grants/models.py 61.9% <0%> (ø) ⬆️
app/dashboard/embed.py 31.6% <0%> (+3.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d98e52...6be6ad1. Read the comment docs.

- estimate_clr.py -> new arguments clr_type, network
- clr logic updated to query grants by network + grant_type + not hidden
- grant str updated to also print grant_type
- crontab updated to run both clr for media and tech grants
Copy link
Contributor

@danlipert danlipert left a comment

Choose a reason for hiding this comment

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

So clean! Approved with just one question

# setup
clr_calc_start_time = timezone.now()

# get all the eligible contributions and calculate total
contributions = Contribution.objects.prefetch_related('subscription').filter(created_on__gte=CLR_START_DATE, created_on__lte=from_date)
debug_output = []
grants = Grant.objects.all()

grants = Grant.objects.none()
Copy link
Contributor

Choose a reason for hiding this comment

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

is this line some kind of fallback? It seems the following if else block would assign grants to something without needing this line

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah ! Just kept it as fallback -> Ideally we would never need this

Copy link
Contributor

Choose a reason for hiding this comment

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

@thelostone-mc I think from a programming logic standpoint there is no case where this would be undefined after the if else block, so I think it should be removed

Copy link
Member Author

@thelostone-mc thelostone-mc Dec 16, 2019

Choose a reason for hiding this comment

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

make's sense. removed ^_^

@thelostone-mc thelostone-mc merged commit a25ab67 into gitcoinco:master Dec 16, 2019
@thelostone-mc thelostone-mc deleted the clr branch January 16, 2020 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants