mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Update some more incorrect types for primary key access/set
This commit is contained in:
parent
2a4bee61dd
commit
aac2aa341c
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
@ -29,8 +30,8 @@ namespace osu.Game.Tests.Scores.IO
|
||||
[Test]
|
||||
public void TestNonMatchingByPrimaryKey()
|
||||
{
|
||||
ScoreInfo score1 = new ScoreInfo { ID = 1 };
|
||||
ScoreInfo score2 = new ScoreInfo { ID = 2 };
|
||||
ScoreInfo score1 = new ScoreInfo { ID = Guid.NewGuid() };
|
||||
ScoreInfo score2 = new ScoreInfo { ID = Guid.NewGuid() };
|
||||
|
||||
Assert.That(score1, Is.Not.EqualTo(score2));
|
||||
}
|
||||
@ -38,8 +39,10 @@ namespace osu.Game.Tests.Scores.IO
|
||||
[Test]
|
||||
public void TestMatchingByPrimaryKey()
|
||||
{
|
||||
ScoreInfo score1 = new ScoreInfo { ID = 1 };
|
||||
ScoreInfo score2 = new ScoreInfo { ID = 1 };
|
||||
Guid id = Guid.NewGuid();
|
||||
|
||||
ScoreInfo score1 = new ScoreInfo { ID = id };
|
||||
ScoreInfo score2 = new ScoreInfo { ID = id };
|
||||
|
||||
Assert.That(score1, Is.EqualTo(score2));
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Users;
|
||||
using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
|
||||
|
||||
namespace osu.Game.Online.Solo
|
||||
{
|
||||
|
@ -490,7 +490,8 @@ namespace osu.Game
|
||||
if (score.OnlineID > 0)
|
||||
databasedScoreInfo = ScoreManager.Query(s => s.OnlineID == score.OnlineID);
|
||||
|
||||
databasedScoreInfo ??= ScoreManager.Query(s => s.Hash == score.Hash);
|
||||
if (score is ScoreInfo scoreInfo)
|
||||
databasedScoreInfo ??= ScoreManager.Query(s => s.Hash == scoreInfo.Hash);
|
||||
|
||||
if (databasedScoreInfo == null)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
{
|
||||
public static int? GetCountGeki(this ScoreInfo scoreInfo)
|
||||
{
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
switch (scoreInfo.Ruleset.OnlineID)
|
||||
{
|
||||
case 3:
|
||||
return getCount(scoreInfo, HitResult.Perfect);
|
||||
@ -20,7 +20,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
public static void SetCountGeki(this ScoreInfo scoreInfo, int value)
|
||||
{
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
switch (scoreInfo.Ruleset.OnlineID)
|
||||
{
|
||||
case 3:
|
||||
scoreInfo.Statistics[HitResult.Perfect] = value;
|
||||
@ -34,7 +34,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
public static int? GetCountKatu(this ScoreInfo scoreInfo)
|
||||
{
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
switch (scoreInfo.Ruleset.OnlineID)
|
||||
{
|
||||
case 3:
|
||||
return getCount(scoreInfo, HitResult.Good);
|
||||
@ -48,7 +48,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
public static void SetCountKatu(this ScoreInfo scoreInfo, int value)
|
||||
{
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
switch (scoreInfo.Ruleset.OnlineID)
|
||||
{
|
||||
case 3:
|
||||
scoreInfo.Statistics[HitResult.Good] = value;
|
||||
@ -62,7 +62,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
public static int? GetCount100(this ScoreInfo scoreInfo)
|
||||
{
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
switch (scoreInfo.Ruleset.OnlineID)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
@ -78,7 +78,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
public static void SetCount100(this ScoreInfo scoreInfo, int value)
|
||||
{
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
switch (scoreInfo.Ruleset.OnlineID)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
@ -94,7 +94,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
public static int? GetCount50(this ScoreInfo scoreInfo)
|
||||
{
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
switch (scoreInfo.Ruleset.OnlineID)
|
||||
{
|
||||
case 0:
|
||||
case 3:
|
||||
@ -109,7 +109,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
public static void SetCount50(this ScoreInfo scoreInfo, int value)
|
||||
{
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
switch (scoreInfo.Ruleset.OnlineID)
|
||||
{
|
||||
case 0:
|
||||
case 3:
|
||||
|
Loading…
Reference in New Issue
Block a user