Commit Graph

47949 Commits

Author SHA1 Message Date
Dean Herbert 51251e3204 Fix CI reported warnings 2022-01-12 22:39:00 +09:00
Dean Herbert 08da948afc
Merge branch 'master' into realm-integration/score-and-beatmaps 2022-01-12 19:22:55 +09:00
Dean Herbert 017f5a9b9b
Merge pull request #16430 from smoogipoo/less-harsh-mania-hp
Fix mania requiring PERFECTs to maintain HP
2022-01-12 19:07:13 +09:00
Dan Balasescu c97db5a863
Merge pull request #16431 from peppy/skin-hash-repopulation
Fix skin hash repopulation not working since realm migration
2022-01-12 19:03:56 +09:00
Dean Herbert 38cc1ce098 Add missing ruleset in test scores 2022-01-12 18:51:30 +09:00
Dean Herbert 8c8c5f4c33 Fix skin hash repopulation not working since realm migration 2022-01-12 18:32:51 +09:00
Dan Balasescu 4106ebf881 Fix mania requiring PERFECTs to maintain HP 2022-01-12 18:29:23 +09:00
Dean Herbert ef0f794fd6 Remove stay newline 2022-01-12 18:13:14 +09:00
Dean Herbert eb70a1eeb7 Replace compatibility properties with direct references 2022-01-12 18:13:14 +09:00
Dean Herbert 482cf29e28
Merge branch 'master' into realm-integration/score-and-beatmaps 2022-01-12 17:57:14 +09:00
Dean Herbert e12025dd48 Cascade delete metadata when beatmaps are deleted 2022-01-12 17:49:11 +09:00
Dean Herbert 34aa1bf21d Sanitise and remove some usages of `Detach` which are no longer required 2022-01-12 17:49:11 +09:00
Dean Herbert 5f7365e8f3 Ensure scores are cleaned up alongside beatmap so they don't have a null reference 2022-01-12 17:49:11 +09:00
Dean Herbert f24b2b1be3 Make copying detached changes to realm only exposed for `BeatmapSet`
Also fixes remaining issues with the copy process.
2022-01-12 17:49:11 +09:00
Dean Herbert a4de0f93fa Move manager `Update` methods to be explicit to where they are still used by legacy code
Also fixes skin hash repopulation being completely broken.
2022-01-12 17:49:11 +09:00
Dean Herbert a307f7e90e Add test coverage of updating via copying changes from detached instance 2022-01-12 17:49:11 +09:00
Dean Herbert 580ad03f8d Combine mapper configurations and add more explanation about special cases 2022-01-12 17:49:11 +09:00
Dean Herbert c92aff8d2b Add test of cyclic beatmap/beatmapset references 2022-01-12 17:49:11 +09:00
Dean Herbert 509301d94f Update detach test to assert correct behaviour 2022-01-12 17:49:11 +09:00
Dean Herbert 51d6db1bca Add equatable support to `IUser` and `RealmUser`
Not sure this will stick, but let's add it for now to make testing
detach support work nicely.
2022-01-12 17:49:11 +09:00
Salman Ahmed 6db3c32dd1 Handle automapper realm cyclic references via `AfterMap`s
This may not be the cleanest solution, but there don't seem to be any
way towards this either.

- `UseDestinationValue` has been inherited by default as noted in
https://docs.automapper.org/en/stable/10.0-Upgrade-Guide.html#usedestinationvalue-is-now-inherited-by-default, and its behaviour in this case would be using the nested **managed** realm object for the destination member rather than creating an unmanaged version.

- `MaxDepth` already sets `PreserveReferences` so there's no point of using it.

- `MaxDepth` should probably not be set for all maps, only for those with
cyclic references, to avoid the expensive overhead of `PreserveReferences`, as mentioned in https://docs.automapper.org/en/stable/5.0-Upgrade-Guide.html#circular-references.

That aside, `MaxDepth` should actually only be set to `1` for
`BeatmapSetInfo` mapping, because we don't want AutoMapper to create a
nested instance of `BeatmapSetInfo` in each mapped/detached beatmap, but
for some reason, doing that will cause automapper to not map any beatmap
inside the set and leave it with 0 beatmaps.

While on the other hand, using `MaxDepth(2)` for `BeatmapSetInfo` works,
but creates an unused instance of a `BeatmapSetInfo` inside each mapped
beatmap, which may not be ideal.

For `BeatmapInfo`, it has to be `MaxDepth(2)`, in which the first
`BeatmapInfo` depth would be itself (when detaching a beatmap), and the
second would be nested beatmaps inside the mapped/detached
`BeatmapSetInfo` within the beatmap. (note that when detaching a beatmap
set, the unused instance of `BeatmapSetInfo` within each beatmap of that
beatmap set doesn't also have a list of unused beatmaps as one might expect from the depth specification, it surprisingly has 0 beatmaps)

This causes it to create an unused instance of `BeatmapInfo` in the beatmap set resembling the root mapped/detached beatmap, but that one might be inevitable.
2022-01-12 17:49:11 +09:00
Dean Herbert dc3730f334 Fix song select import popup not always showing 2022-01-12 17:49:11 +09:00
Dean Herbert 017285b694 Update `MusicController` to handle deletions more correctly 2022-01-12 17:49:11 +09:00
Dean Herbert 157dfdaa82 Fix protected beatmap sets getting deleted 2022-01-12 17:49:11 +09:00
Dean Herbert 0aff1c232b Fix deleted/hidden carousel queries 2022-01-12 17:49:11 +09:00
Dean Herbert 72656ae01e Fix beatmap restore/undelete flows 2022-01-12 17:49:11 +09:00
Dean Herbert 46206f70d6 Fix beatmap mass deletion flow 2022-01-12 17:49:11 +09:00
Dean Herbert d5239d550a Add refetch for non-managed hide/restore attempts 2022-01-12 17:49:11 +09:00
Dean Herbert e0c59f4b3c Localise EF context factory usage to migration only 2022-01-12 17:49:11 +09:00
Dean Herbert bf4133021b Update migration test to use realm file as test 2022-01-12 17:49:11 +09:00
Dean Herbert 46e92c3b60 Clean up `BeatmapManager` query methods 2022-01-12 17:49:11 +09:00
Dean Herbert 9beabad6a4 Remove hide/restore event flow 2022-01-12 17:49:11 +09:00
Dean Herbert c06b5951fd Fix multiple remaining warnings 2022-01-12 17:49:11 +09:00
Dean Herbert e8dcbaf29a Fix intro screen hitting null reference if intro beatmap is unavailable 2022-01-12 17:49:11 +09:00
Dean Herbert 7dba3c3551 Fix most remaining test issues 2022-01-12 17:49:11 +09:00
Dean Herbert b7ee6d1866 Add protections against test null refs when beatmap load fails 2022-01-12 17:49:11 +09:00
Dean Herbert f986c3ebd4 Add basic write support via automapper 2022-01-12 17:49:11 +09:00
Dean Herbert 80eee6d7b0 Make `RealmArchiveModelManager.Update` work using automapper 2022-01-12 17:49:11 +09:00
Dean Herbert 7509a9ff8f Update `BeatmapModelManager.Save` to work for editor scenarios 2022-01-12 17:49:11 +09:00
Dean Herbert dc9ea4adeb Remove incorrect test assertion 2022-01-12 17:49:11 +09:00
Dean Herbert 8c3dc4333d Fix incorrect realm access after new beatmap import 2022-01-12 17:49:11 +09:00
Dean Herbert 64a47ff850 Allow `RealmArchiveModelManager` file operations to be performed on detached instances 2022-01-12 17:49:11 +09:00
Dean Herbert dd19487eb8 Fix custom import process in `TestSceneDrawableRoomPlaylist` not working with realm 2022-01-12 17:49:11 +09:00
Dean Herbert 6613a7e4ae Fix another case of test ruleset without overriding `ShortName` primary key 2022-01-12 17:49:11 +09:00
Dean Herbert cd88ccab4f Fix `TestScenePlaySongSelect` failure due to detach clone depth 2022-01-12 17:49:11 +09:00
Dean Herbert 9e2ca583a3 Fix incorrect realm factory isolation in `TestScenePlaySongSelect` 2022-01-12 17:49:11 +09:00
Dean Herbert 2ce80cc030 Add back caching in `WorkingBeatmapCache` 2022-01-12 17:49:11 +09:00
Dean Herbert 286994a808 Fix `BeatmapDifficulty` cloning regression 2022-01-12 17:49:11 +09:00
Dean Herbert b5975eee33 This file should have been deleted in a previous commit (rebase failure) 2022-01-12 17:49:11 +09:00
Dean Herbert 58f8aae731 Fix one missed instance of `GetResultSafely` 2022-01-12 17:49:11 +09:00