Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BeatmapInfo.LastUpdate to track the time of local changes #19530

Merged
merged 4 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions osu.Game/Beatmaps/BeatmapInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ public BeatmapOnlineStatus Status

public string OnlineMD5Hash { get; set; } = string.Empty;

/// <summary>
/// The last time of a local modification (via the editor).
/// </summary>
public DateTimeOffset? LastLocalUpdate { get; set; }

/// <summary>
/// The last time online metadata was applied to this beatmap.
/// </summary>
public DateTimeOffset? LastOnlineUpdate { get; set; }

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions osu.Game/Beatmaps/BeatmapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public WorkingBeatmap CreateNew(RulesetInfo ruleset, APIUser user)

var beatmapSet = new BeatmapSetInfo
{
DateAdded = DateTimeOffset.UtcNow,
Beatmaps =
{
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata)
Expand Down Expand Up @@ -313,6 +314,7 @@ public virtual void Save(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
beatmapInfo.Hash = stream.ComputeSHA2Hash();

beatmapInfo.LastLocalUpdate = DateTimeOffset.Now;
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;

AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
Expand Down
3 changes: 2 additions & 1 deletion osu.Game/Database/RealmAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ public class RealmAccess : IDisposable
/// 20 2022-07-21 Added LastAppliedDifficultyVersion to RulesetInfo, changed default value of BeatmapInfo.StarRating to -1.
/// 21 2022-07-27 Migrate collections to realm (BeatmapCollection).
/// 22 2022-07-31 Added ModPreset.
/// 23 2022-08-01 Added LastLocalUpdate to BeatmapInfo.
/// </summary>
private const int schema_version = 22;
private const int schema_version = 23;

/// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
Expand Down