foreach to Linq.SUM
This commit is contained in:
@@ -67,12 +67,13 @@ namespace OurUmbraco.Community.Controllers
|
||||
|
||||
// filter to only include items from the last year
|
||||
var filteredRange = DateTime.UtcNow.AddYears(-1).Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
var contribWeeks = contrib.Weeks.Where(x => x.W >= filteredRange);
|
||||
|
||||
foreach (var contrib in gitHubContributors)
|
||||
{
|
||||
contrib.Total = contrib.w;
|
||||
var contribWeeks = contrib.Weeks.Where(x => x.W >= filteredRange).ToList();
|
||||
contrib.TotalAdditions = contribWeeks.Sum(x=>x.A);
|
||||
contrib.TotalDeletions = contribWeeks.Sum(x=>x.D);
|
||||
contrib.Total = contrib.TotalAdditions + contrib.TotalDeletions;
|
||||
}
|
||||
|
||||
var filteredContributors = gitHubContributors
|
||||
|
||||
Reference in New Issue
Block a user