Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pack pass check considering converted plays when pack is not asso…
…ciated with a ruleset Reported privately. The corresponding web-10 query looks like this (somewhat abridged): SELECT COUNT(*) FROM ( SELECT p.beatmapset_id FROM osu_beatmappacks_items p JOIN osu_beatmaps b USING (beatmapset_id) JOIN osu_scores_high s USING (beatmap_id) WHERE s.user_id = userId AND b.playmode = 0 AND pack_id = packId UNION DISTINCT SELECT p.beatmapset_id FROM osu_beatmappacks_items p JOIN osu_beatmaps b USING (beatmapset_id) JOIN osu_scores_taiko_high s USING (beatmap_id) WHERE s.user_id = userId AND b.playmode = 1 AND pack_id = packId UNION DISTINCT SELECT p.beatmapset_id FROM osu_beatmappacks_items p JOIN osu_beatmaps b USING (beatmapset_id) JOIN osu_scores_fruits_high s USING (beatmap_id) WHERE s.user_id = userId AND b.playmode = 2 AND pack_id = packId UNION DISTINCT SELECT p.beatmapset_id FROM osu_beatmappacks_items p JOIN osu_beatmaps b USING (beatmapset_id) JOIN osu_scores_mania_high s USING (beatmap_id) WHERE s.user_id = userId} AND b.playmode = 3 AND pack_id = packId) a If it is not immediately clear why the above disallows converts, then to spell it out: it is the part that the query is split into four `UNION`'d parts, each of which queries only one `scores_high` table for each of the rulesets, and only includes the beatmaps in the pack which have the same `playmode`. For profiling purposes, here are two examples of query shapes after this change, taken from the test: SELECT COUNT(distinct p.beatmapset_id) FROM osu_beatmappacks_items p JOIN osu_beatmaps b USING (beatmapset_id) JOIN scores s USING (beatmap_id) WHERE s.user_id = 2 AND s.passed = 1 AND s.preserve = 1 AND pack_id = 40 AND `s`.`ruleset_id` = `b`.`playmode` SELECT COUNT(distinct p.beatmapset_id) FROM osu_beatmappacks_items p JOIN osu_beatmaps b USING (beatmapset_id) JOIN scores s USING (beatmap_id) WHERE s.user_id = 2 AND s.passed = 1 AND s.preserve = 1 AND pack_id = 2036 AND `s`.`ruleset_id` = `b`.`playmode` AND json_search(data, 'one', 'EZ', null, '$.mods[*].acronym') IS NULL AND json_search(data, 'one', 'NF', null, '$.mods[*].acronym') IS NULL AND json_search(data, 'one', 'HT', null, '$.mods[*].acronym') IS NULL AND json_search(data, 'one', 'DC', null, '$.mods[*].acronym') IS NULL AND json_search(data, 'one', 'SO', null, '$.mods[*].acronym') IS NULL AND s.pp IS NOT NULL
- Loading branch information