-
Notifications
You must be signed in to change notification settings - Fork 54
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
Conversation
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.
LGTM, just a few nitpicks and questions
ProjectLighthouse.Servers.GameServer/Controllers/Resources/ResourcesController.cs
Outdated
Show resolved
Hide resolved
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.
Looks good, see my question in the comment though
ProjectLighthouse.Servers.GameServer/Controllers/Resources/ResourcesController.cs
Outdated
Show resolved
Hide resolved
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.
Decided to take another look at this since there have been changes since I approved a month ago. Still looks good.
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.