Skip to content

Migrate scores to use proper relationships #830

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

Merged
merged 17 commits into from
Aug 19, 2023

Conversation

Slendy
Copy link
Contributor

@Slendy Slendy commented Jul 6, 2023

The old way scores worked was using players' usernames in a comma-delimited list which has obvious problems like being able to spoof scores because the system ultimately trusts the score uploader. Other problems include different permutations of usernames will create entirely new scores instead of updating old ones.

The migration uses raw SQL because after the migration the entity is no longer compatible and would be complicated to implement with EF as it is now. There is a new feature in NET 8.0 to map raw SQL queries to objects but it doesn't release until November of this year.

Some drawbacks of the new system are that non-existent users are no longer allowed to keep scores. This also means that once a user is deleted, all of their scores will also be deleted. In some cases this is beneficial; for example, if a single user cheated many scores you can remove all of their scores by simply deleting their account.

Since this PR also creates more scores per level since every user gets their own score regardless of the number of players that were in the session, there also needs to be a rework of the score viewer on the website to have pagination and filter by score type but that's outside the scope of this PR.

TODO

In some cases where people have multiple scores under the same level and category will have their highest score selected and kept.

@Slendy Slendy requested review from Zaprit and sudokoko July 8, 2023 22:54
Copy link
Member

@sudokoko sudokoko left a comment

Choose a reason for hiding this comment

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

LGTM, just a few nitpicks and questions

Copy link
Member

@Zaprit Zaprit left a comment

Choose a reason for hiding this comment

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

Looks good, see my question in the comment though

@Slendy Slendy mentioned this pull request Aug 4, 2023
6 tasks
Copy link
Member

@sudokoko sudokoko left a comment

Choose a reason for hiding this comment

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

Decided to take another look at this since there have been changes since I approved a month ago. Still looks good.

@Slendy Slendy added this pull request to the merge queue Aug 19, 2023
Merged via the queue into LBPUnion:main with commit 70a66e6 Aug 19, 2023
@Slendy Slendy deleted the score-migration branch August 27, 2023 05:31
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.

3 participants