From e89566b61b4d208b7de566eda01da24993115f62 Mon Sep 17 00:00:00 2001
From: shiibe <82057235+shiibe@users.noreply.github.com>
Date: Sun, 9 Jun 2024 23:12:03 -0400
Subject: [PATCH] Fix
---
.../Components/Song/SongLeaderboardCard.razor | 2 +-
.../Song/SongLeaderboardCard.razor.cs | 21 ++++++-------------
2 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/TaikoWebUI/Components/Song/SongLeaderboardCard.razor b/TaikoWebUI/Components/Song/SongLeaderboardCard.razor
index 8cd98d3..0334fbe 100644
--- a/TaikoWebUI/Components/Song/SongLeaderboardCard.razor
+++ b/TaikoWebUI/Components/Song/SongLeaderboardCard.razor
@@ -54,7 +54,7 @@
@Localizer["Rank"]
- @if ( @context.Rank > 0 && @context.BestScore > 0)
+ @if (@context.Rank > 0 && @context.BestScore > 0)
{
@context.Rank
diff --git a/TaikoWebUI/Components/Song/SongLeaderboardCard.razor.cs b/TaikoWebUI/Components/Song/SongLeaderboardCard.razor.cs
index 8713015..21653ed 100644
--- a/TaikoWebUI/Components/Song/SongLeaderboardCard.razor.cs
+++ b/TaikoWebUI/Components/Song/SongLeaderboardCard.razor.cs
@@ -62,24 +62,15 @@ public partial class SongLeaderboardCard
// set TotalPages
TotalPages = response.TotalPages;
- if (response.UserScore != null)
+ if (response.UserScore != null
+ && LeaderboardScores.All(x => x.Baid != response.UserScore.Baid)
+ && (LeaderboardScores.Count == 0 || response.UserScore.Rank >= LeaderboardScores[0].Rank))
{
- // if baid isn't already in the LeaderboardScores, add it
- if (LeaderboardScores.All(x => x.Baid != response.UserScore.Baid))
- {
- LeaderboardScores.Add(new SongLeaderboard()); // Add an empty row
- LeaderboardScores.Add(response.UserScore);
- }
+ LeaderboardScores.Add(new SongLeaderboard()); // Add an empty row
+ LeaderboardScores.Add(response.UserScore);
}
-
+
TotalRows = LeaderboardScores.Count;
-
- // log the LeaderboardScores
- foreach (var score in LeaderboardScores)
- {
- Console.WriteLine(score.Rank + " " + score.Baid + " " + score.UserName + " " + score.BestScore + " " + score.BestRate + " " + score.BestCrown + " " + score.BestScoreRank);
- }
-
isLoading = false;
}