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

makes grant info calculation imdipident #4582

Merged
merged 3 commits into from
Jun 11, 2019
Merged

Conversation

owocki
Copy link
Contributor

@owocki owocki commented Jun 5, 2019

Description

makes grant info calculation imdipident

this makes debugging / correcting thte grant detail information much easier, since you don't have to reason about when the callback functions were calculated. you just construct the info from state everytime you calc it.

Refers/Fixes

https://gitcoincore.slack.com/archives/CAXQ7PT60/p1559671421017900

Testing

tested it locally. http://bits.owocki.com/424bf1731bfb/Image%202019-06-04%20at%208.02.04%20PM.png

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.

Looks pretty good! Just a question and 2 leftover print()s

@@ -659,14 +661,17 @@ def get_converted_amount(self):
return None

def get_converted_monthly_amount(self):
converted_amount = self.get_converted_amount()
if self.num_tx_approved == 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats this line for? Checking if its a one-time contribution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes


instance.amount_received = 0
instance.monthly_amount_subscribed = 0
print(instance.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

leftover print


if subscription.num_tx_processed <= subscription.num_tx_approved and value_usdt:
instance.monthly_amount_subscribed += subscription.get_converted_monthly_amount()
print("-", subscription.id, value_usdt, instance.monthly_amount_subscribed )
Copy link
Contributor

Choose a reason for hiding this comment

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

another print :) if we want these, lets use the logger 👍

@codecov
Copy link

codecov bot commented Jun 11, 2019

Codecov Report

Merging #4582 into stable will decrease coverage by <.01%.
The diff coverage is 14.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           stable    #4582      +/-   ##
==========================================
- Coverage   17.58%   17.57%   -0.01%     
==========================================
  Files         200      200              
  Lines       17070    17129      +59     
  Branches     2320     2345      +25     
==========================================
+ Hits         3002     3011       +9     
- Misses      14056    14103      +47     
- Partials       12       15       +3
Impacted Files Coverage Δ
app/grants/models.py 48.37% <14.28%> (-1.8%) ⬇️
app/dashboard/helpers.py 11.87% <0%> (+0.25%) ⬆️

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 21462f0...3ad762c. Read the comment docs.

@owocki owocki merged commit d5a8e01 into stable Jun 11, 2019
@thelostone-mc thelostone-mc deleted the kevin/fix_grant_details branch July 4, 2019 14:54
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