Skip to content

Commit

Permalink
- player stats stub update
Browse files Browse the repository at this point in the history
  • Loading branch information
SoapyMan committed Jul 7, 2022
1 parent 21b2f2f commit 50bf150
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions DSFServices/Services/PlayerStatisticsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ public RMCResult ReadStatsLeaderboardByRange(int boardId, int columnId, int rank
var playerStats = new List<ScoreListRead>();
uint playersTotal = 0;

using (var db = DBHelper.GetDbContext())
{
var playerBoards = db.PlayerStatisticBoards
.Where(x => x.BoardId == boardId);

playersTotal = (uint)playerBoards.Count();
}

return Result(new { a = playerStats, b = playersTotal });
}

Expand All @@ -187,6 +195,18 @@ public RMCResult ReadStatsLeaderboardByPIDs(IEnumerable<LeaderboardData> dataLis
var playerStats = new List<ScoreListRead>();
uint playersTotal = 0;

using (var db = DBHelper.GetDbContext())
{
foreach(var data in dataList)
{
var playerBoards = db.PlayerStatisticBoards
.Where(x => x.BoardId == data.boardId)
.Where(x => playerPIDs.Contains(x.PlayerId));

playersTotal += (uint)playerBoards.Count();
}
}

return Result(new { a = playerStats, b = playersTotal });
}

Expand Down

0 comments on commit 50bf150

Please sign in to comment.