Skip to content

Commit

Permalink
Add totals summary for nuget stats
Browse files Browse the repository at this point in the history
This allows simpler static dynamic badges using shields.io against the raw data files.
  • Loading branch information
kzu committed Sep 28, 2024
1 parent e409d24 commit abc4a4f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Core/Records.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,15 @@ public record OwnerRepo(string Owner, string Repo);

public record FundedRepository(string OwnerRepo, string[] Sponsorables);

public record OpenSource(ConcurrentDictionary<string, HashSet<string>> Authors, ConcurrentDictionary<string, HashSet<string>> Repositories, ConcurrentDictionary<string, ConcurrentDictionary<string, long>> Packages);
public record OpenSource(ConcurrentDictionary<string, HashSet<string>> Authors, ConcurrentDictionary<string, HashSet<string>> Repositories, ConcurrentDictionary<string, ConcurrentDictionary<string, long>> Packages)
{
public OpenSourceSummary Totals => new(this);

public class OpenSourceSummary(OpenSource source)
{
public long Authors => source.Authors.Count;
public long Repositories => source.Repositories.Count;
public long Packages => source.Packages.Sum(x => x.Value.Count);
public long Downloads => source.Packages.Sum(x => x.Value.Sum(y => y.Value));
}
}

0 comments on commit abc4a4f

Please sign in to comment.