1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 15:12:57 +08:00

Fix some data types on ScoreInfo

This commit is contained in:
Dean Herbert 2018-11-30 20:43:38 +09:00
parent cc488fe275
commit af3ef9a089
6 changed files with 15 additions and 16 deletions

View File

@ -9,7 +9,7 @@ using osu.Game.Database;
namespace osu.Game.Migrations namespace osu.Game.Migrations
{ {
[DbContext(typeof(OsuDbContext))] [DbContext(typeof(OsuDbContext))]
[Migration("20181130084152_AddScoreInfoTables")] [Migration("20181130113755_AddScoreInfoTables")]
partial class AddScoreInfoTables partial class AddScoreInfoTables
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -309,7 +309,8 @@ namespace osu.Game.Migrations
b.Property<int>("ID") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<double>("Accuracy"); b.Property<double>("Accuracy")
.HasColumnType("DECIMAL(1,4)");
b.Property<int>("BeatmapInfoID"); b.Property<int>("BeatmapInfoID");
@ -321,8 +322,6 @@ namespace osu.Game.Migrations
b.Property<string>("Hash"); b.Property<string>("Hash");
b.Property<double>("Health");
b.Property<int>("MaxCombo"); b.Property<int>("MaxCombo");
b.Property<string>("ModsJson") b.Property<string>("ModsJson")
@ -339,7 +338,7 @@ namespace osu.Game.Migrations
b.Property<string>("StatisticsJson") b.Property<string>("StatisticsJson")
.HasColumnName("Statistics"); .HasColumnName("Statistics");
b.Property<double>("TotalScore"); b.Property<int>("TotalScore");
b.Property<string>("UserString") b.Property<string>("UserString")
.HasColumnName("User"); .HasColumnName("User");

View File

@ -14,9 +14,8 @@ namespace osu.Game.Migrations
ID = table.Column<int>(nullable: false) ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Rank = table.Column<int>(nullable: false), Rank = table.Column<int>(nullable: false),
TotalScore = table.Column<double>(nullable: false), TotalScore = table.Column<int>(nullable: false),
Accuracy = table.Column<double>(nullable: false), Accuracy = table.Column<double>(type: "DECIMAL(1,4)", nullable: false),
Health = table.Column<double>(nullable: false),
PP = table.Column<double>(nullable: true), PP = table.Column<double>(nullable: true),
MaxCombo = table.Column<int>(nullable: false), MaxCombo = table.Column<int>(nullable: false),
Combo = table.Column<int>(nullable: false), Combo = table.Column<int>(nullable: false),

View File

@ -307,7 +307,8 @@ namespace osu.Game.Migrations
b.Property<int>("ID") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<double>("Accuracy"); b.Property<double>("Accuracy")
.HasColumnType("DECIMAL(1,4)");
b.Property<int>("BeatmapInfoID"); b.Property<int>("BeatmapInfoID");
@ -319,8 +320,6 @@ namespace osu.Game.Migrations
b.Property<string>("Hash"); b.Property<string>("Hash");
b.Property<double>("Health");
b.Property<int>("MaxCombo"); b.Property<int>("MaxCombo");
b.Property<string>("ModsJson") b.Property<string>("ModsJson")
@ -337,7 +336,7 @@ namespace osu.Game.Migrations
b.Property<string>("StatisticsJson") b.Property<string>("StatisticsJson")
.HasColumnName("Statistics"); .HasColumnName("Statistics");
b.Property<double>("TotalScore"); b.Property<int>("TotalScore");
b.Property<string>("UserString") b.Property<string>("UserString")
.HasColumnName("User"); .HasColumnName("User");

View File

@ -16,7 +16,7 @@ namespace osu.Game.Online.API.Requests.Responses
public class APIScoreInfo : ScoreInfo public class APIScoreInfo : ScoreInfo
{ {
[JsonProperty(@"score")] [JsonProperty(@"score")]
private double totalScore private int totalScore
{ {
set => TotalScore = value; set => TotalScore = value;
} }

View File

@ -160,10 +160,10 @@ namespace osu.Game.Rulesets.Scoring
/// </summary> /// </summary>
public virtual void PopulateScore(ScoreInfo score) public virtual void PopulateScore(ScoreInfo score)
{ {
score.TotalScore = TotalScore; score.TotalScore = (int)Math.Round(TotalScore);
score.Combo = Combo; score.Combo = Combo;
score.MaxCombo = HighestCombo; score.MaxCombo = HighestCombo;
score.Accuracy = Accuracy; score.Accuracy = Math.Round(Accuracy, 4);
score.Rank = Rank; score.Rank = Rank;
score.Date = DateTimeOffset.Now; score.Date = DateTimeOffset.Now;
score.Health = Health; score.Health = Health;

View File

@ -21,10 +21,12 @@ namespace osu.Game.Scoring
public ScoreRank Rank { get; set; } public ScoreRank Rank { get; set; }
public double TotalScore { get; set; } public int TotalScore { get; set; }
[Column(TypeName="DECIMAL(1,4)")]
public double Accuracy { get; set; } public double Accuracy { get; set; }
[NotMapped]
public double Health { get; set; } = 1; public double Health { get; set; } = 1;
public double? PP { get; set; } public double? PP { get; set; }