diff --git a/LichessTournamentAggregator.App/LichessTournamentAggregator.App.csproj b/LichessTournamentAggregator.App/LichessTournamentAggregator.App.csproj index 19c8689..4879640 100644 --- a/LichessTournamentAggregator.App/LichessTournamentAggregator.App.csproj +++ b/LichessTournamentAggregator.App/LichessTournamentAggregator.App.csproj @@ -7,7 +7,7 @@ win-x64;win-x86;linux-x64;osx-x64 true true - 0.2.2 + 0.3.0 Eduardo Cáceres Multiplatform desktop app that allows you to aggregate the results of multiple Lichess tournaments diff --git a/LichessTournamentAggregator.Test/AggregatedResultTest.cs b/LichessTournamentAggregator.Test/AggregatedResultTest.cs index ebca7b2..c57b04d 100644 --- a/LichessTournamentAggregator.Test/AggregatedResultTest.cs +++ b/LichessTournamentAggregator.Test/AggregatedResultTest.cs @@ -212,6 +212,7 @@ public void Ranks() new TournamentResult() { Username = Username, + Rank = 0 }, new TournamentResult() { @@ -234,7 +235,7 @@ public void Ranks() foreach (var rank in aggregatedResult.Ranks) { - Assert.Single(results, (result) => result.Username == aggregatedResult.Username && result.Rank == rank); + Assert.Single(results, (result) => result.Username == aggregatedResult.Username && result.Rank + 1 == rank); } } @@ -243,11 +244,6 @@ public void AveragePerformance() { ICollection results = new[] { - new TournamentResult() - { - Username = Username, - Rank = 0 - }, new TournamentResult() { Username = Username, @@ -277,7 +273,7 @@ public void AveragePerformance() AggregatedResult aggregatedResult = new AggregatedResult(results.GroupBy(r => r.Username).Single(g => g.Key == Username)); Assert.Equal( - (double)results.Where(r => r.Username == Username).Sum(r => r.Performance) / results.Count(r => r.Username == Username && r.Rank != 0), + (double)results.Where(r => r.Username == Username).Sum(r => r.Performance) / results.Count(r => r.Username == Username), aggregatedResult.AveragePerformance); } diff --git a/LichessTournamentAggregator/LichessTournamentAggregator.csproj b/LichessTournamentAggregator/LichessTournamentAggregator.csproj index 8789fa6..954c094 100644 --- a/LichessTournamentAggregator/LichessTournamentAggregator.csproj +++ b/LichessTournamentAggregator/LichessTournamentAggregator.csproj @@ -7,7 +7,7 @@ snupkg LichessTournamentAggregator LichessTournamentAggregator - 0.3.2 + 0.4.0 Chess, Lichess, Tournament, Aggregator $(PackageTags) Eduardo Cáceres diff --git a/LichessTournamentAggregator/Model/AggregatedResult.cs b/LichessTournamentAggregator/Model/AggregatedResult.cs index eec8e8c..49346c8 100644 --- a/LichessTournamentAggregator/Model/AggregatedResult.cs +++ b/LichessTournamentAggregator/Model/AggregatedResult.cs @@ -56,12 +56,12 @@ public AggregatedResult(IGrouping results) Username = results.First().Username; Title = results.First().Title; MaxRating = results.Max(p => p.Rating); - Ranks = results.Select(p => p.Rank); + Ranks = results.Select(p => p.Rank + 1); Scores = results.Select(p => CalculatePoints(p.Score)); TieBreaks = results.Select(p => p.TieBreak); TotalScores = Scores.Sum(); TotalTieBreaks = TieBreaks.Sum(); - AveragePerformance = (double)results.Select(p => p.Performance).Sum() / results.Count(p => p.Rank != 0); + AveragePerformance = (double)results.Select(p => p.Performance).Sum() / results.Count(); } ///