mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Mark BeatmapSet.Status
as modified when any beatmap is modified, rather than all
This commit is contained in:
parent
df76f9f4da
commit
8cb02f47eb
@ -312,14 +312,13 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
||||
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
||||
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||
|
||||
if (setInfo.Beatmaps.All(b => b.Status == BeatmapOnlineStatus.LocallyModified))
|
||||
setInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||
|
||||
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
||||
|
||||
setInfo.Hash = beatmapImporter.ComputeHash(setInfo);
|
||||
setInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||
|
||||
Realm.Write(r =>
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using osu.Framework.Development;
|
||||
@ -103,9 +104,11 @@ namespace osu.Game.Beatmaps
|
||||
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
||||
{
|
||||
beatmapInfo.Status = res.Status;
|
||||
|
||||
beatmapInfo.Metadata.Author.OnlineID = res.AuthorID;
|
||||
}
|
||||
|
||||
if (beatmapInfo.BeatmapSet.Beatmaps.All(b => b.MatchesOnlineVersion || b.Status != BeatmapOnlineStatus.LocallyModified))
|
||||
{
|
||||
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
|
||||
beatmapInfo.BeatmapSet.DateRanked = res.BeatmapSet?.Ranked;
|
||||
beatmapInfo.BeatmapSet.DateSubmitted = res.BeatmapSet?.Submitted;
|
||||
@ -208,7 +211,12 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
var status = (BeatmapOnlineStatus)reader.GetByte(2);
|
||||
|
||||
beatmapInfo.Status = status;
|
||||
// Some metadata should only be applied if there's no local changes.
|
||||
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
||||
{
|
||||
beatmapInfo.Status = status;
|
||||
beatmapInfo.Metadata.Author.OnlineID = reader.GetInt32(3);
|
||||
}
|
||||
|
||||
// TODO: DateSubmitted and DateRanked are not provided by local cache.
|
||||
beatmapInfo.OnlineID = reader.GetInt32(1);
|
||||
@ -218,11 +226,9 @@ namespace osu.Game.Beatmaps
|
||||
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)
|
||||
if (beatmapInfo.BeatmapSet.Beatmaps.All(b => b.MatchesOnlineVersion || b.Status != BeatmapOnlineStatus.LocallyModified))
|
||||
{
|
||||
beatmapInfo.BeatmapSet.Status = status;
|
||||
beatmapInfo.Metadata.Author.OnlineID = reader.GetInt32(3);
|
||||
}
|
||||
|
||||
logForModel(set, $"Cached local retrieval for {beatmapInfo}.");
|
||||
|
Loading…
Reference in New Issue
Block a user