Skip to content

Commit

Permalink
Fix Ranks off-by-one error (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio authored Nov 17, 2021
1 parent 3d4c17a commit afc06c7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;osx-x64</RuntimeIdentifiers>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<Version>0.3.1</Version>
<Version>0.3.2</Version>
<Authors>Eduardo Cáceres</Authors>
<Description>
Multiplatform desktop app that allows you to aggregate the results of multiple Lichess tournaments
Expand Down
2 changes: 1 addition & 1 deletion LichessTournamentAggregator.Test/AggregatedResultTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void Ranks()

foreach (var rank in aggregatedResult.Ranks)
{
Assert.Single(results, (result) => result.Username == aggregatedResult.Username && result.Rank + 1 == rank);
Assert.Single(results, (result) => result.Username == aggregatedResult.Username && result.Rank == rank);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Title>LichessTournamentAggregator</Title>
<PackageId>LichessTournamentAggregator</PackageId>
<Version>0.4.1</Version>
<Version>0.4.2</Version>
<PackageTags>Chess, Lichess, Tournament, Aggregator</PackageTags>
<Tags>$(PackageTags)</Tags>
<Authors>Eduardo Cáceres</Authors>
Expand Down
2 changes: 1 addition & 1 deletion LichessTournamentAggregator/Model/AggregatedResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public AggregatedResult(IGrouping<string, TournamentResult> results)
Username = results.First().Username;
Title = results.First().Title;
MaxRating = results.Max(p => p.Rating);
Ranks = results.Select(p => p.Rank + 1);
Ranks = results.Select(p => p.Rank);
Scores = results.Select(p => p.Score >= p.Points ? p.Score : p.Points); // A TournamentResult should only have either Score (Arena tournaments) or Points (Swiss tournaments)
TieBreaks = results.Select(p => p.TieBreak);
TotalScores = Scores.Sum();
Expand Down

0 comments on commit afc06c7

Please sign in to comment.