public static ColPerfStallCoverage New(CollectorPerformanceRow colPerfRow, ICollectionsDB db)
        {
            var sc = new ColPerfStallCoverage();

            sc.CollectedsCount = colPerfRow.Count;

            foreach (var sec in colPerfRow.Sections)
            {
                if (db.Uncollecteds.TryGetValue(sec.Id, out IUncollectedsRepo uncolRepo))
                {
                    sc.UncollectedsCount += uncolRepo.GetAll().Count;
                }

                if (db.NoOperations.TryGetValue(sec.Id, out INoOperationsRepo noOpsRepo))
                {
                    sc.NoOperationsCount += noOpsRepo.GetAll().Count;
                }
            }
            return(sc);
        }
        public static CollectorPerformanceRow New(CollectorDTO collector, IStallsRepo fallbackStallsRepo, ICollectionsDB db, IMarketStateDB mkt)
        {
            var cp       = new CollectorPerformanceRow(collector);
            var sections = db.SectionsSnapshot ?? mkt.Sections.GetAll();

            foreach (var sec in sections)
            {
                cp.AddSubRows(collector, sec, db, fallbackStallsRepo);
            }

            cp.Sections = cp.DistinctBy(_ => _.Section.Id)
                          .Select(_ => _.Section)
                          .ToList();

            cp.StallCoverage = ColPerfStallCoverage.New(cp, db);
            cp.RentBill      = ColPerfBillPerformance.New(BillCode.Rent, cp.Select(_ => _.Rent));
            cp.RightsBill    = ColPerfBillPerformance.New(BillCode.Rights, cp.Select(_ => _.Rights));

            cp.SetSummary(new CollectorPerfSubRowsTotal(cp));

            return(cp);
        }