public async Task <IReadOnlyCollection <ScoringCriterionPrompt> > GetCriterionPromptsAsync(long projectId, AreaType areaType) { var scoringApplication = await _scoringApplicationRepository.GetByProjectIdAsync(projectId); var criteriaPromps = await _scoringCriterionRepository.GetScoringCriterionPromptsAsync(scoringApplication.Id, areaType); switch (areaType) { case AreaType.Hr: await AddHrCriterionPromptExceptions(scoringApplication.Id, criteriaPromps); break; case AreaType.Marketer: var socialNetworks = (await _scoringApplicationRepository.GetByIdAsync(scoringApplication.Id)).SocialNetworks; foreach (var id in _criterionsWithSocialNetworksPrompts) { criteriaPromps.Add(new ScoringCriterionPrompt { CriterionId = id, SocialNetworks = socialNetworks, PromptType = ScoringCriterionPromptType.SocialNetwork }); } break; } return(criteriaPromps.ToArray()); }
public async Task <ProjectSummaryResponse> GetSummaryAsync(long id) { var project = await _projectService.GetByIdAsync(id); var scoring = await _scoringService.GetByProjectIdAsync(id); var scoringApplication = await _scoringApplicationRepository.GetByProjectIdAsync(id); return(ProjectSummaryResponse.Create(project, scoring, scoringApplication, _clock.UtcNow)); }
public async Task SetScoringTransactionAsync(long projectId, string transactionHash, long userId) { var application = await _scoringApplicationRepository.GetByProjectIdAsync(projectId) ?? throw new AppErrorException(ErrorCode.ScoringApplicationNotFound); var transactionId = await _ethereumTransactionService.StartAsync(transactionHash, userId, EthereumTransactionEntityType.ScoringApplication, application.Id, EthereumTransactionType.StartScoring); application.ScoringStartTransactionId = transactionId; await _scoringApplicationRepository.SaveChangesAsync(); }
public Task <ScoringApplication> GetApplicationAsync(long projectId) => _scoringApplicationRepository.GetByProjectIdAsync(projectId);