Script to actualise the santa data based on updated balances and actual friends invited counts #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
updated_santa_users
table not to recalculate then again (eskimo for convenience).What is changed in database:
badge_progress
:friends_invited
achieved_badges
(recalculated based on milestones except level badges)completed_levels
(only when user has invited_friends task completed attask_progress
table, and wheninvited_friends
is less than milestone for this task completion)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).levels_and_roles_progress
:friends_invited
enabled_roles
(can have null or ambassador)completed_tasks
(it can be decreased by -1 only when user hasinvited_friends
task completed attask_progress
table, and wheninvited_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)task_progress
:friends_invited
completed_tasks
andpseudo_completed_tasks
can be changed by removinginvite_friends
task only when user has invited_friends task completed attask_progress
table, and wheninvited_friends
is less than milestone for this task completion.friends_invited
:friends_invited
fieldHow to run
Where
2023-10-23T13:09:24.220169Z
is the timestamp when the freezer's balances were recalculated.