mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +08:00
Avoid json serialisation of aggregate helper properties
Also avoids `throw`ing when there are no beatmaps available. Until now this wasn't an issue due to the `Beatmaps` list being null instead of empty.
This commit is contained in:
parent
8c60f37508
commit
a3fdab34d5
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
@ -30,6 +31,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public BeatmapMetadata Metadata { get; set; }
|
||||
|
||||
[NotNull]
|
||||
public List<BeatmapInfo> Beatmaps { get; } = new List<BeatmapInfo>();
|
||||
|
||||
public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None;
|
||||
@ -40,17 +42,20 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// The maximum star difficulty of all beatmaps in this set.
|
||||
/// </summary>
|
||||
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarRating) ?? 0;
|
||||
[JsonIgnore]
|
||||
public double MaxStarDifficulty => Beatmaps.Count == 0 ? 0 : Beatmaps.Max(b => b.StarRating);
|
||||
|
||||
/// <summary>
|
||||
/// The maximum playable length in milliseconds of all beatmaps in this set.
|
||||
/// </summary>
|
||||
public double MaxLength => Beatmaps?.Max(b => b.Length) ?? 0;
|
||||
[JsonIgnore]
|
||||
public double MaxLength => Beatmaps.Count == 0 ? 0 : Beatmaps.Max(b => b.Length);
|
||||
|
||||
/// <summary>
|
||||
/// The maximum BPM of all beatmaps in this set.
|
||||
/// </summary>
|
||||
public double MaxBPM => Beatmaps?.Max(b => b.BPM) ?? 0;
|
||||
[JsonIgnore]
|
||||
public double MaxBPM => Beatmaps.Count == 0 ? 0 : Beatmaps.Max(b => b.BPM);
|
||||
|
||||
[NotMapped]
|
||||
public bool DeletePending { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user