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

Fix beatmap carousel not maintaining selection if currently selected beatmap is updated #19409

Merged
merged 11 commits into from
Aug 29, 2022

Conversation

peppy
Copy link
Member

@peppy peppy commented Jul 27, 2022

RFC. I've tested this to work, but adding tests is a bit involved. Want to make sure the solution seems okay before adding them.

@LittleEndu
Copy link
Contributor

Looking at the code, doesn't this fail when the update to the beatmap is a deletion of the selected difficulty?

@peppy
Copy link
Member Author

peppy commented Jul 27, 2022

Can you explain what you mean and which line is at fault? I can't read minds.

// Best effort matching. We can't use ID because in the update flow a new version will get its own GUID.
bool selectionMatches =
((IBeatmapMetadataInfo)beatmapInfo.Metadata).Equals(SelectedBeatmapInfo.Metadata)
&& beatmapInfo.DifficultyName == SelectedBeatmapInfo.DifficultyName;
Copy link
Contributor

Choose a reason for hiding this comment

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

I meant this. Isn't this true only if the difficulty also exists in the updated beatmap.

I would think if the beatmap set's metadata matches, it's OK to select any difficulty, not necessarily the one that was previously selected.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. A BeatmapSet's metadata is currently just a reference to the first beatmap in the set, so it gets a bit difficult to guarantee anything there.

There are other scenarios such as if the difficulty name is changed (or the title of the beatmap is changed) which will lose selection in a similar way, so if we want to be more inclusive then a fallback selection can be added. See 24d7561.

@peppy peppy requested a review from smoogipoo July 27, 2022 05:30
@LittleEndu
Copy link
Contributor

I want to try this. Should I wait for tests to be added or can I test in prod?

@frenzibyte
Copy link
Member

You should be able to test this in-game by modifying the beatmap however you want then update and see if it selects properly.

@peppy
Copy link
Member Author

peppy commented Jul 27, 2022

To clarify, you can use the staging/dev environment and download a beatmap, then make a change via realm studio or the editor.

@peppy peppy added the blocked Don't merge this. label Aug 2, 2022
@peppy peppy removed the blocked Don't merge this. label Aug 22, 2022
@peppy
Copy link
Member Author

peppy commented Aug 22, 2022

This was incorrectly blocked, should actually be okay to review.

@peppy peppy requested a review from frenzibyte August 26, 2022 10:46
@peppy peppy added the next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! label Aug 26, 2022
frenzibyte
frenzibyte previously approved these changes Aug 26, 2022
@frenzibyte
Copy link
Member

@peppy Do you still plan to add tests to this PR? It's blocking merge currently.

@peppy
Copy link
Member Author

peppy commented Aug 26, 2022

will see what i can do

@peppy
Copy link
Member Author

peppy commented Aug 29, 2022

I've added test coverage for this (confirmed to fail on master).

@peppy peppy requested a review from frenzibyte August 29, 2022 06:24
@frenzibyte frenzibyte enabled auto-merge August 29, 2022 08:23
@frenzibyte frenzibyte merged commit b56fbac into ppy:master Aug 29, 2022
@peppy peppy deleted the carousel-maintain-selection-over-update branch August 31, 2022 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:song-select next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating a selected beatmap may not follow selection at song select
3 participants