1
0
mirror of synced 2024-11-27 16:10:53 +01:00

Fixed ura scores not being read

It's kinda messy I think, but it works.
This commit is contained in:
Deathblood 2022-09-01 20:24:36 -05:00
parent a0027c6ddd
commit a5b8bb10ff

View File

@ -30,7 +30,7 @@ public class SelfBestController : ControllerBase
var difficulty = (Difficulty)request.Level; var difficulty = (Difficulty)request.Level;
var playerBestData = context.SongBestData var playerBestData = context.SongBestData
.Where(datum => datum.Baid == request.Baid && .Where(datum => datum.Baid == request.Baid &&
datum.Difficulty == difficulty) (datum.Difficulty == difficulty || (datum.Difficulty == Difficulty.UraOni && difficulty == Difficulty.Oni)))
.ToList(); .ToList();
foreach (var songNo in request.ArySongNoes) foreach (var songNo in request.ArySongNoes)
{ {
@ -40,16 +40,27 @@ public class SelfBestController : ControllerBase
continue; continue;
} }
var songBestDatum = playerBestData.FirstOrDefault(datum => datum.SongId == songNo, new SongBestDatum()); var songBestDatum = playerBestData.Where(datum => datum.SongId == songNo);
var selfBestData = new SelfBestResponse.SelfBestData var selfBestData = new SelfBestResponse.SelfBestData
{ {
SongNo = songNo, SongNo = songNo,
SelfBestScore = difficulty != Difficulty.UraOni ? songBestDatum.BestScore : 0,
SelfBestScoreRate = difficulty != Difficulty.UraOni ? songBestDatum.BestRate : 0,
UraBestScore = difficulty == Difficulty.UraOni ? songBestDatum.BestScore : 0,
UraBestScoreRate = difficulty == Difficulty.UraOni ? songBestDatum.BestRate : 0
}; };
foreach (var datum in songBestDatum)
{
if (datum.Difficulty == difficulty)
{
selfBestData.SelfBestScore = datum.BestScore;
selfBestData.SelfBestScoreRate = datum.BestRate;
}
else if (datum.Difficulty == Difficulty.UraOni)
{
selfBestData.UraBestScore = datum.BestScore;
selfBestData.UraBestScoreRate = datum.BestRate;
}
}
response.ArySelfbestScores.Add(selfBestData); response.ArySelfbestScores.Add(selfBestData);
} }
response.ArySelfbestScores.Sort((data, otherData) => data.SongNo.CompareTo(otherData.SongNo)); response.ArySelfbestScores.Sort((data, otherData) => data.SongNo.CompareTo(otherData.SongNo));