-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
chore: fix earning tables #9236
Conversation
code seems sane to me i havent tested, but id love to see where it hiccups on a prod-db-backup before running on prod |
also you should run this report before/after and see if anything goes wonky eg if anyone has a 100000000000000 GMV in USD after you know something went wrong |
Yup i'll have it run on staging and see how that plays out @gitcoinco/engineers could you guys check it out ? once we agree it looks sane -> I'll run it on staging |
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.
Loooking good! 🚀
I think it would be sensible to make the 0x0
change, but its not 100% clear to me why we don't have those txids? Would it be possible for us to find them? Would the report still make sense without them?
tokens = Token.objects.filter(approved=True) | ||
|
||
for bounty_fulfillment in bounty_fulfillments: | ||
token_name = bounty_fulfillment.token_name |
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.
Consider: And here
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.
we're using filter, here so it should be fine
|
||
|
||
# filter earning which have txid | ||
earnings_with_txid = earnings_mainnet.filter(txid__isnull=False).exclude(txid__exact='') |
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.
It would be worth excluding 0x0
here too (theres 2538 of them on prod) - and it might be a good idea to clear their usdt values?
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.
++ on this
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.
would be worth excluding 0x0 here too
makes sense
and it might be a good idea to clear their usdt values?
I'm not sure if this is something we should do right now. might need a lil bit more analysis for this
cause these seem to come from std bounties which may not have been wired in right
|
||
|
||
# filter earning which have txid | ||
earnings_with_txid = earnings_mainnet.filter(txid__isnull=False).exclude(txid__exact='') |
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.
++ on this
"""Fix earnings.""" | ||
|
||
print("Pulling in every Earning") | ||
# e = Earning.objects.all() |
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.
Did you mean to leave this commented code in?
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.
Ah that is dead code! not needed
|
||
|
||
# ============================= STEP 4 ======================= | ||
# fetch only bounty fulfillments and fixes decimal issue |
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.
Should say only tips
instead of only bounty fulfillments
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.
Will purge this a day after we release. So izz okay
This was simply to get the team to 👀 on what I was trying to do here
Description
This PR ends up
- A) updating the value in Earnings Table with the right amount for
- B) setting Earning to false if the contributions was false
- C) updated BountyFulfillments payout_amount when if it's not represented in it's normalized value
- D) fixed code where BountyFulfillments payout_amount is not stored as normalized value
- E) increase the token_value to 18 decimals in Earnings Model
Refers/Fixes
https://metabase.gitcoin.co/question/1054
Testing
Has been tested locally with snapshot of live data