Skip to content

Commit

Permalink
Improve StarsPerRepository selection and ordering
Browse files Browse the repository at this point in the history
The StarsPerRepository property now filters out repositories with null or empty names, orders the remaining repositories by stargazer count in descending order, and then takes the top 10 to convert into a dictionary. This ensures a more accurate representation of the top repositories by stargazer count.
  • Loading branch information
sametcn99 committed Aug 3, 2024
1 parent 2d7c6df commit 590ba1b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions GPVBlazor/GPVBlazor/Models/StatModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public class RepositoryStats
.ToDictionary(group => group.Key!, group => group.Count());

public Dictionary<string, int> StarsPerRepository => _repositories
.Take(10)
.ToDictionary(repo => repo.Name!, repo => repo.StargazersCount);
.Where(repo => !string.IsNullOrEmpty(repo.Name))
.OrderByDescending(repo => repo.StargazersCount)
.Take(10)
.ToDictionary(repo => repo.Name!, repo => repo.StargazersCount);
}
}

0 comments on commit 590ba1b

Please sign in to comment.