From ea3de6a696c9c8a0c2753e53ccfc9bee8c6eaa7f Mon Sep 17 00:00:00 2001 From: "roi.ezra" Date: Fri, 20 Sep 2024 13:13:19 +0300 Subject: [PATCH] fixed --- Mundialito/Controllers/StatsController.cs | 2 +- Mundialito/DAL/Games/GameExtensionMethods.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Mundialito/Controllers/StatsController.cs b/Mundialito/Controllers/StatsController.cs index aa0260a..6c1d6b4 100644 --- a/Mundialito/Controllers/StatsController.cs +++ b/Mundialito/Controllers/StatsController.cs @@ -64,7 +64,7 @@ public async Task> GetStats(string username) private async Task> CalcStats(MundialitoUser requestedUser, MundialitoUser loggedUser, IEnumerable followees) { - var games = (float)gamesRepository.GetGames().Count(); + var games = (float)gamesRepository.GetGames().Where((game) => game.IsBetResolved()).Count(); var users = (float)userManager.Users.Count(); var bets = betsRepository.GetBets().Where((bet) => bet.IsResolved()).ToList(); var table = tableBuilder.GetTable(userManager.Users.Select((user) => new UserWithPointsModel(user)), bets, generalBetsRepository.GetGeneralBets()); diff --git a/Mundialito/DAL/Games/GameExtensionMethods.cs b/Mundialito/DAL/Games/GameExtensionMethods.cs index dfcdea6..a19b889 100644 --- a/Mundialito/DAL/Games/GameExtensionMethods.cs +++ b/Mundialito/DAL/Games/GameExtensionMethods.cs @@ -2,34 +2,34 @@ public static class GameExtensionMethods { - public static Boolean IsOpen(this Game game) + public static bool IsOpen(this Game game) { return game.IsOpen(DateTime.UtcNow); } - public static Boolean IsOpen(this Game game, DateTime now) + public static bool IsOpen(this Game game, DateTime now) { return now < game.CloseTime; } - public static Boolean IsPendingUpdate(this Game game) + public static bool IsPendingUpdate(this Game game) { return game.IsPendingUpdate(DateTime.UtcNow); } - public static Boolean IsPendingUpdate(this Game game, DateTime now) + public static bool IsPendingUpdate(this Game game, DateTime now) { if (game.IsOpen(now)) return false; return game.HomeScore == null || game.AwayScore == null || game.CardsMark == null || game.CornersMark == null; } - public static Boolean IsBetResolved(this Game game) + public static bool IsBetResolved(this Game game) { return game.IsBetResolved(DateTime.UtcNow); } - public static Boolean IsBetResolved(this Game game, DateTime now) + public static bool IsBetResolved(this Game game, DateTime now) { return !game.IsOpen(now) && !game.IsPendingUpdate(now); } @@ -40,7 +40,7 @@ public static String Mark(this Game game) return game.Mark(DateTime.UtcNow); } - public static String Mark(this Game game, DateTime now) + public static string Mark(this Game game, DateTime now) { if (!game.IsOpen(now)) {