mirror of
https://github.com/osukey/osukey.git
synced 2025-05-09 23:57:18 +09:00
Fix some additional metadata being updated when it shouldn't (with local changes)
This commit is contained in:
parent
4adc8375e9
commit
df76f9f4da
@ -95,20 +95,21 @@ namespace osu.Game.Beatmaps
|
|||||||
beatmapInfo.OnlineID = res.OnlineID;
|
beatmapInfo.OnlineID = res.OnlineID;
|
||||||
beatmapInfo.OnlineMD5Hash = res.MD5Hash;
|
beatmapInfo.OnlineMD5Hash = res.MD5Hash;
|
||||||
beatmapInfo.LastOnlineUpdate = res.LastUpdated;
|
beatmapInfo.LastOnlineUpdate = res.LastUpdated;
|
||||||
beatmapInfo.Metadata.Author.OnlineID = res.AuthorID;
|
|
||||||
|
|
||||||
Debug.Assert(beatmapInfo.BeatmapSet != null);
|
Debug.Assert(beatmapInfo.BeatmapSet != null);
|
||||||
|
beatmapInfo.BeatmapSet.OnlineID = res.OnlineBeatmapSetID;
|
||||||
|
|
||||||
// In the case local changes have been applied, don't reset the status.
|
// Some metadata should only be applied if there's no local changes.
|
||||||
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
||||||
{
|
{
|
||||||
beatmapInfo.Status = res.Status;
|
beatmapInfo.Status = res.Status;
|
||||||
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
beatmapInfo.BeatmapSet.OnlineID = res.OnlineBeatmapSetID;
|
beatmapInfo.Metadata.Author.OnlineID = res.AuthorID;
|
||||||
beatmapInfo.BeatmapSet.DateRanked = res.BeatmapSet?.Ranked;
|
|
||||||
beatmapInfo.BeatmapSet.DateSubmitted = res.BeatmapSet?.Submitted;
|
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
|
||||||
|
beatmapInfo.BeatmapSet.DateRanked = res.BeatmapSet?.Ranked;
|
||||||
|
beatmapInfo.BeatmapSet.DateSubmitted = res.BeatmapSet?.Submitted;
|
||||||
|
}
|
||||||
|
|
||||||
logForModel(set, $"Online retrieval mapped {beatmapInfo} to {res.OnlineBeatmapSetID} / {res.OnlineID}.");
|
logForModel(set, $"Online retrieval mapped {beatmapInfo} to {res.OnlineBeatmapSetID} / {res.OnlineID}.");
|
||||||
}
|
}
|
||||||
@ -209,17 +210,21 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
beatmapInfo.Status = status;
|
beatmapInfo.Status = status;
|
||||||
|
|
||||||
Debug.Assert(beatmapInfo.BeatmapSet != null);
|
|
||||||
|
|
||||||
beatmapInfo.BeatmapSet.Status = status;
|
|
||||||
beatmapInfo.BeatmapSet.OnlineID = reader.GetInt32(0);
|
|
||||||
// TODO: DateSubmitted and DateRanked are not provided by local cache.
|
// TODO: DateSubmitted and DateRanked are not provided by local cache.
|
||||||
beatmapInfo.OnlineID = reader.GetInt32(1);
|
beatmapInfo.OnlineID = reader.GetInt32(1);
|
||||||
beatmapInfo.Metadata.Author.OnlineID = reader.GetInt32(3);
|
|
||||||
|
|
||||||
beatmapInfo.OnlineMD5Hash = reader.GetString(4);
|
beatmapInfo.OnlineMD5Hash = reader.GetString(4);
|
||||||
beatmapInfo.LastOnlineUpdate = reader.GetDateTimeOffset(5);
|
beatmapInfo.LastOnlineUpdate = reader.GetDateTimeOffset(5);
|
||||||
|
|
||||||
|
Debug.Assert(beatmapInfo.BeatmapSet != null);
|
||||||
|
beatmapInfo.BeatmapSet.OnlineID = reader.GetInt32(0);
|
||||||
|
|
||||||
|
// Some metadata should only be applied if there's no local changes.
|
||||||
|
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
||||||
|
{
|
||||||
|
beatmapInfo.BeatmapSet.Status = status;
|
||||||
|
beatmapInfo.Metadata.Author.OnlineID = reader.GetInt32(3);
|
||||||
|
}
|
||||||
|
|
||||||
logForModel(set, $"Cached local retrieval for {beatmapInfo}.");
|
logForModel(set, $"Cached local retrieval for {beatmapInfo}.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user