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

chore: fix earning tables #9236

Merged
merged 6 commits into from
Jul 6, 2021
Merged

chore: fix earning tables #9236

merged 6 commits into from
Jul 6, 2021

Conversation

thelostone-mc
Copy link
Member

@thelostone-mc thelostone-mc commented Jun 30, 2021

Description

This PR ends up

- A) updating the value in Earnings Table with the right amount for
  • Contributions
  • Kudos
  • Tips
  • Bounty Fulfillments
- 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
  • GITC-118
  • GITC-119
  • GITC-99

https://metabase.gitcoin.co/question/1054

Testing

Has been tested locally with snapshot of live data

@thelostone-mc thelostone-mc marked this pull request as ready for review July 1, 2021 18:03
@owocki
Copy link
Contributor

owocki commented Jul 1, 2021

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

@owocki
Copy link
Contributor

owocki commented Jul 1, 2021

also you should run this report before/after and see if anything goes wonky

#9236

eg if anyone has a 100000000000000 GMV in USD after you know something went wrong

@thelostone-mc
Copy link
Member Author

thelostone-mc commented Jul 2, 2021

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

Copy link
Contributor

@gdixon gdixon left a 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?

app/economy/management/commands/fix_earnings.py Outdated Show resolved Hide resolved
tokens = Token.objects.filter(approved=True)

for bounty_fulfillment in bounty_fulfillments:
token_name = bounty_fulfillment.token_name
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider: And here

Copy link
Member Author

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='')
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

++ on this

Copy link
Member Author

@thelostone-mc thelostone-mc Jul 6, 2021

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='')
Copy link
Contributor

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()
Copy link
Contributor

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?

Copy link
Member Author

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
Copy link
Contributor

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

Copy link
Member Author

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

@thelostone-mc thelostone-mc merged commit db28f85 into stable Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants