Skip to content

Commit

Permalink
Merge pull request #19 from IowaComputerGurus/feature/fix-report
Browse files Browse the repository at this point in the history
Temporary fix for #18 with a report having no storage
  • Loading branch information
mitchelsellers authored Jan 10, 2023
2 parents 96aedac + bfea1c5 commit ebe7f4c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,22 @@ group x by x.Repository
into grp
select new KeyValuePair<string, decimal>(grp.Key, grp.Sum(i => i.Quantity.GetValueOrDefault()) / grp.Count())).ToList();
}
else
{
//Default values
model.AverageDailyStorage = 0m;
model.AverageDailyStorageByRepo = new List<KeyValuePair<string, decimal>>();
}

return model;
}

private DailyStorageData GenerateStorageByDays(List<GithubUsageEntry> entries)
{
var storage = entries.Where(e => e.Product.Equals(Constants.GitHubProducts.SharedStorage, StringComparison.InvariantCultureIgnoreCase)).ToList();
if(!storage.Any())
return new DailyStorageData();

var startDate = storage.Min(r => r.Date);
var endDate = storage.Max(r => r.Date);

Expand Down

0 comments on commit ebe7f4c

Please sign in to comment.