Add statistics to list of rom sets.

This commit is contained in:
2020-08-24 01:57:15 +01:00
parent 86b63e5e31
commit 3d87c2e778
7 changed files with 108 additions and 44 deletions

View File

@@ -370,15 +370,23 @@ namespace RomRepoMgr.ViewModels
ThenBy(r => r.Date).ThenBy(r => r.Description).ThenBy(r => r.Comment).
ThenBy(r => r.Filename).Select(r => new RomSetModel
{
Author = r.Author,
Comment = r.Comment,
Date = r.Date,
Description = r.Description,
Filename = r.Filename,
Homepage = r.Homepage,
Name = r.Name,
Sha384 = r.Sha384,
Version = r.Version
Author = r.Author,
Comment = r.Comment,
Date = r.Date,
Description = r.Description,
Filename = r.Filename,
Homepage = r.Homepage,
Name = r.Name,
Sha384 = r.Sha384,
Version = r.Version,
TotalMachines = r.Machines.Count,
CompleteMachines =
r.Machines.Count(m => m.Files.All(f => f.File.IsInRepo)),
IncompleteMachines =
r.Machines.Count(m => m.Files.Any(f => !f.File.IsInRepo)),
TotalRoms = r.Machines.Sum(m => m.Files.Count),
HaveRoms = r.Machines.Sum(m => m.Files.Count(f => f.File.IsInRepo)),
MissRoms = r.Machines.Sum(m => m.Files.Count(f => !f.File.IsInRepo))
}).ToList()
});