private async Task <IEnumerable <ScoringProjectDetailsWithCounts> > ConvertAreaStatisticsToProjectDetailsAsync( ScoringProjectStatus status, IEnumerable <ScoringAreaStatistics> statistics) { var areasByScoringId = statistics.ToLookup( o => o.ScoringId, k => new AreaExpertsCounters(k.AreaId, k.AcceptedCount, k.RequiredCount)); var projects = await _projectRepository.GetByScoringIdsAsync(areasByScoringId.Select(o => o.Key).ToArray()); return(projects.Select(d => CreateScoringProjectDetailsWithCounts(status, areasByScoringId[d.Scoring.Id].ToArray(), d))); }
public ScoringProjectDetailsWithCounts( ScoringProjectStatus status, IReadOnlyCollection <AreaExpertsCounters> areaCounts, long projectId, Guid projectExternalId, long scoringId, Address contractAddress, string name, DateTimeOffset creationDate, DateTimeOffset acceptingDeadline) : base(projectId, projectExternalId, scoringId, contractAddress, name, creationDate, acceptingDeadline) { Status = status; AreaCounts = areaCounts; }
private static ScoringProjectDetailsWithCounts CreateScoringProjectDetailsWithCounts( ScoringProjectStatus status, IReadOnlyCollection <AreaExpertsCounters> areaCounts, Project project) { return(new ScoringProjectDetailsWithCounts( status, areaCounts, project.Id, project.ExternalId, project.Scoring.Id, project.Scoring.ContractAddress, project.Name, project.Scoring.CreationDate, project.Scoring.AcceptingDeadline)); }