mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-06 11:58:38 +00:00
Fix some situations where scores were null
This commit is contained in:
parent
cf348002af
commit
c12894af92
1 changed files with 15 additions and 6 deletions
|
@ -34,7 +34,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
|
||||
score.SlotId = id;
|
||||
|
||||
IQueryable<Score> existingScore = this.database.Scores.Where(s => s.PlayerIdCollection == score.PlayerIdCollection);
|
||||
IQueryable<Score> existingScore = this.database.Scores.Where(s => s.SlotId == score.SlotId && s.PlayerIdCollection == score.PlayerIdCollection);
|
||||
|
||||
if (existingScore.Any())
|
||||
{
|
||||
|
@ -82,11 +82,20 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
return current + rs.Score.Serialize();
|
||||
});
|
||||
|
||||
string res = LbpSerializer.TaggedStringElement("scores", serializedScores, new Dictionary<string, object>() {
|
||||
string res;
|
||||
if (myScore == null)
|
||||
{
|
||||
res = LbpSerializer.StringElement("scores", serializedScores);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = LbpSerializer.TaggedStringElement("scores", serializedScores, new Dictionary<string, object>() {
|
||||
{"yourScore", myScore.Score.Points},
|
||||
{"yourRank", myScore.Rank }, //This is the numerator of your position globally in the side menu.
|
||||
{"totalNumScores", rankedScores.Count() } // This is the denominator of your position globally in the side menu.
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return this.Ok(res);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue