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

Script to actualise the santa data based on updated balances and actual friends invited counts #28

Merged
merged 9 commits into from
Oct 24, 2023

Conversation

ice-myles
Copy link
Contributor

@ice-myles ice-myles commented Oct 16, 2023

The problem

Due to bugs that were fixed after the app release launch, part of the users have got the wrong T1/T2 balances calculations, as result theirs standard + pre staking balances are wrong.
Also some bugs could increase and not decrease the friends invited count.
Everything could affect on badges, levels and roles, tasks.

To reduce the inequality we must actualise the badges, levels and roles, tasks, friends invited for everybody so that everyone is on equal terms.

The solution

  • The implementation takes the actual tiers information from eskimo users table (friends invited).
  • Then takes the needed for the logic information from badges and task progress tables.
  • Updates the santa tables.
  • Persist recalculated users at updated_santa_users table not to recalculate then again (eskimo for convenience).

What is changed in database:

  1. badge_progress:
  • friends_invited
  • achieved_badges (recalculated based on milestones except level badges)
  • completed_levels (only when user has invited_friends task completed at task_progress table, and when invited_friends is less than milestone for this task completion)
  1. badge_statistics - script takes the difference between old badges and new recalculated badges (except level badges), and the diff adds/subs to badge statistics for each separate badge (except general as they have total users count values).
  2. levels_and_roles_progress:
  • friends_invited
  • enabled_roles (can have null or ambassador)
  • completed_tasks (it can be decreased by -1 only when user has invited_friends task completed at task_progress table, and when invited_friends is less than milestone for this task completion)
  • completed_levels (11 level can be removed when the same case happens as with completed tasks)
  1. task_progress:
  • friends_invited
  • completed_tasks and pseudo_completed_tasks can be changed by removing invite_friends task only when user has invited_friends task completed at task_progress table, and when invited_friends is less than milestone for this task completion.
  1. friends_invited:
  • friends_invited field

How to run

go run update_santa_badges_levels_and_roles_tasks.go -bugfixStartTimestamp=2023-10-23T13:09:24.220169Z

Where 2023-10-23T13:09:24.220169Z is the timestamp when the freezer's balances were recalculated.

@ice-myles ice-myles added the enhancement New feature or request label Oct 16, 2023
@ice-myles ice-myles self-assigned this Oct 16, 2023
@ice-myles ice-myles marked this pull request as ready for review October 17, 2023 20:20
@ice-myles ice-myles requested a review from a team as a code owner October 17, 2023 20:21
@ice-myles ice-myles enabled auto-merge (squash) October 17, 2023 20:21
@ice-ares ice-ares merged commit 56f8cc1 into master Oct 24, 2023
21 checks passed
@ice-ares ice-ares deleted the feature/script-actualise-santa-data branch October 24, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants