Skip to content

Commit abc4a4f

Browse files
committed
Add totals summary for nuget stats
This allows simpler static dynamic badges using shields.io against the raw data files.
1 parent e409d24 commit abc4a4f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Core/Records.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,15 @@ public record OwnerRepo(string Owner, string Repo);
3535

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

38-
public record OpenSource(ConcurrentDictionary<string, HashSet<string>> Authors, ConcurrentDictionary<string, HashSet<string>> Repositories, ConcurrentDictionary<string, ConcurrentDictionary<string, long>> Packages);
38+
public record OpenSource(ConcurrentDictionary<string, HashSet<string>> Authors, ConcurrentDictionary<string, HashSet<string>> Repositories, ConcurrentDictionary<string, ConcurrentDictionary<string, long>> Packages)
39+
{
40+
public OpenSourceSummary Totals => new(this);
41+
42+
public class OpenSourceSummary(OpenSource source)
43+
{
44+
public long Authors => source.Authors.Count;
45+
public long Repositories => source.Repositories.Count;
46+
public long Packages => source.Packages.Sum(x => x.Value.Count);
47+
public long Downloads => source.Packages.Sum(x => x.Value.Sum(y => y.Value));
48+
}
49+
}

0 commit comments

Comments
 (0)