mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 20:33:11 +08:00
Add ranked and submitted date storage and filtering
This commit is contained in:
parent
07874efa7f
commit
30daa0fd44
@ -102,6 +102,8 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
|
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
|
||||||
beatmapInfo.BeatmapSet.OnlineID = res.OnlineBeatmapSetID;
|
beatmapInfo.BeatmapSet.OnlineID = res.OnlineBeatmapSetID;
|
||||||
|
beatmapInfo.BeatmapSet.DateRanked = res.BeatmapSet?.Ranked;
|
||||||
|
beatmapInfo.BeatmapSet.DateSubmitted = res.BeatmapSet?.Submitted;
|
||||||
|
|
||||||
beatmapInfo.OnlineMD5Hash = res.MD5Hash;
|
beatmapInfo.OnlineMD5Hash = res.MD5Hash;
|
||||||
beatmapInfo.LastOnlineUpdate = res.LastUpdated;
|
beatmapInfo.LastOnlineUpdate = res.LastUpdated;
|
||||||
@ -194,7 +196,8 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
using (var cmd = db.CreateCommand())
|
using (var cmd = db.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = "SELECT beatmapset_id, beatmap_id, approved, user_id, checksum, last_update FROM osu_beatmaps WHERE checksum = @MD5Hash OR beatmap_id = @OnlineID OR filename = @Path";
|
cmd.CommandText =
|
||||||
|
"SELECT beatmapset_id, beatmap_id, approved, user_id, checksum, last_update FROM osu_beatmaps WHERE checksum = @MD5Hash OR beatmap_id = @OnlineID OR filename = @Path";
|
||||||
|
|
||||||
cmd.Parameters.Add(new SqliteParameter("@MD5Hash", beatmapInfo.MD5Hash));
|
cmd.Parameters.Add(new SqliteParameter("@MD5Hash", beatmapInfo.MD5Hash));
|
||||||
cmd.Parameters.Add(new SqliteParameter("@OnlineID", beatmapInfo.OnlineID));
|
cmd.Parameters.Add(new SqliteParameter("@OnlineID", beatmapInfo.OnlineID));
|
||||||
@ -212,6 +215,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
beatmapInfo.BeatmapSet.Status = status;
|
beatmapInfo.BeatmapSet.Status = status;
|
||||||
beatmapInfo.BeatmapSet.OnlineID = reader.GetInt32(0);
|
beatmapInfo.BeatmapSet.OnlineID = reader.GetInt32(0);
|
||||||
|
// 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.Metadata.Author.OnlineID = reader.GetInt32(3);
|
||||||
|
|
||||||
|
@ -26,6 +26,16 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public DateTimeOffset DateAdded { get; set; }
|
public DateTimeOffset DateAdded { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The date this beatmap set was first submitted.
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset? DateSubmitted { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The date this beatmap set was ranked.
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset? DateRanked { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IBeatmapMetadataInfo Metadata => Beatmaps.FirstOrDefault()?.Metadata ?? new BeatmapMetadata();
|
public IBeatmapMetadataInfo Metadata => Beatmaps.FirstOrDefault()?.Metadata ?? new BeatmapMetadata();
|
||||||
|
|
||||||
|
@ -62,8 +62,9 @@ namespace osu.Game.Database
|
|||||||
/// 16 2022-07-15 Removed HasReplay from ScoreInfo.
|
/// 16 2022-07-15 Removed HasReplay from ScoreInfo.
|
||||||
/// 17 2022-07-16 Added CountryCode to RealmUser.
|
/// 17 2022-07-16 Added CountryCode to RealmUser.
|
||||||
/// 18 2022-07-19 Added OnlineMD5Hash and LastOnlineUpdate to BeatmapInfo.
|
/// 18 2022-07-19 Added OnlineMD5Hash and LastOnlineUpdate to BeatmapInfo.
|
||||||
|
/// 19 2022-07-19 Added DateSubmitted and DateRanked to BeatmapSetInfo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int schema_version = 18;
|
private const int schema_version = 19;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
||||||
|
@ -55,6 +55,8 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) ||
|
match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) ||
|
||||||
criteria.Artist.Matches(BeatmapInfo.Metadata.ArtistUnicode);
|
criteria.Artist.Matches(BeatmapInfo.Metadata.ArtistUnicode);
|
||||||
|
|
||||||
|
match &= criteria.Sort != SortMode.DateRanked || BeatmapInfo.BeatmapSet?.DateRanked != null;
|
||||||
|
|
||||||
match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarRating);
|
match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarRating);
|
||||||
|
|
||||||
if (match && criteria.SearchTerms.Length > 0)
|
if (match && criteria.SearchTerms.Length > 0)
|
||||||
|
@ -81,6 +81,13 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
case SortMode.DateAdded:
|
case SortMode.DateAdded:
|
||||||
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
|
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
|
||||||
|
|
||||||
|
case SortMode.DateRanked:
|
||||||
|
// Beatmaps which have no ranked date should already be filtered away in this mode.
|
||||||
|
if (BeatmapSet.DateRanked == null || otherSet.BeatmapSet.DateRanked == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return otherSet.BeatmapSet.DateRanked.Value.CompareTo(BeatmapSet.DateRanked.Value);
|
||||||
|
|
||||||
case SortMode.LastPlayed:
|
case SortMode.LastPlayed:
|
||||||
return -compareUsingAggregateMax(otherSet, b => (b.LastPlayed ?? DateTimeOffset.MinValue).ToUnixTimeSeconds());
|
return -compareUsingAggregateMax(otherSet, b => (b.LastPlayed ?? DateTimeOffset.MinValue).ToUnixTimeSeconds());
|
||||||
|
|
||||||
|
@ -23,6 +23,9 @@ namespace osu.Game.Screens.Select.Filter
|
|||||||
[Description("Date Added")]
|
[Description("Date Added")]
|
||||||
DateAdded,
|
DateAdded,
|
||||||
|
|
||||||
|
[Description("Date Ranked")]
|
||||||
|
DateRanked,
|
||||||
|
|
||||||
[Description("Last Played")]
|
[Description("Last Played")]
|
||||||
LastPlayed,
|
LastPlayed,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user