mirror of
https://github.com/ppy/osu
synced 2024-12-12 01:48:49 +00:00
Tidy up comments and code
This commit is contained in:
parent
a4a9223726
commit
5bd91a531d
@ -206,14 +206,12 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
base.PostImport(model, realm, parameters);
|
base.PostImport(model, realm, parameters);
|
||||||
|
|
||||||
//Because of specific score storing in Osu! database, it can already contain scores for imported beatmap.
|
// Scores are stored separately from beatmaps, and persisted when a beatmap is modified or deleted.
|
||||||
//To restore scores we need to manually reassign them to new/re-exported beatmap.
|
// Let's reattach any matching scores that exist in the database, based on hash.
|
||||||
foreach (BeatmapInfo beatmap in model.Beatmaps)
|
foreach (BeatmapInfo beatmap in model.Beatmaps)
|
||||||
{
|
{
|
||||||
IQueryable<ScoreInfo> scores = realm.All<ScoreInfo>().Where(score => score.BeatmapHash == beatmap.Hash);
|
foreach (var score in realm.All<ScoreInfo>().Where(score => score.BeatmapHash == beatmap.Hash))
|
||||||
|
score.BeatmapInfo = beatmap;
|
||||||
if (scores.Any())
|
|
||||||
scores.ForEach(score => score.BeatmapInfo = beatmap); //We intentionally ignore BeatmapHash because we checked hash equality
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessBeatmap?.Invoke(model, parameters.Batch ? MetadataLookupScope.LocalCacheFirst : MetadataLookupScope.OnlineFirst);
|
ProcessBeatmap?.Invoke(model, parameters.Batch ? MetadataLookupScope.LocalCacheFirst : MetadataLookupScope.OnlineFirst);
|
||||||
|
Loading…
Reference in New Issue
Block a user