public async Task <Result <ProjectDashboardResponseDto> > GetData(int projectId, FiltersRequestDto filtersDto) { if (filtersDto.EndDate < filtersDto.StartDate) { return(Success(new ProjectDashboardResponseDto())); } var filters = MapToReportFilters(projectId, filtersDto); var reportsByFeaturesAndDate = await _reportsDashboardByFeatureService.GetReportsGroupedByFeaturesAndDate(filters, filtersDto.GroupingType); var dashboardDataDto = new ProjectDashboardResponseDto { Summary = await _projectDashboardSummaryService.GetData(filters), ReportsGroupedByHealthRiskAndDate = await _reportsDashboardByHealthRiskService.GetReportsGroupedByHealthRiskAndDate(filters, filtersDto.GroupingType), ReportsGroupedByFeaturesAndDate = reportsByFeaturesAndDate, ReportsGroupedByVillageAndDate = await _reportsDashboardByVillageService.GetReportsGroupedByVillageAndDate(filters, filtersDto.GroupingType), ReportsGroupedByLocation = await _reportsDashboardMapService.GetProjectSummaryMap(filters), ReportsGroupedByFeatures = GetReportsGroupedByFeatures(reportsByFeaturesAndDate), DataCollectionPointReportsGroupedByDate = filtersDto.ReportsType == FiltersRequestDto.ReportsTypeDto.DataCollectionPoint ? await _reportsDashboardByDataCollectionPointService.GetDataCollectionPointReports(filters, filtersDto.GroupingType) : Enumerable.Empty <DataCollectionPointsReportsByDateDto>() }; return(Success(dashboardDataDto)); }
public async Task <Result <NationalSocietyDashboardResponseDto> > GetData(int nationalSocietyId, NationalSocietyDashboardFiltersRequestDto filtersDto) { if (filtersDto.EndDate < filtersDto.StartDate) { return(Success(new NationalSocietyDashboardResponseDto())); } var filters = MapToReportFilters(nationalSocietyId, filtersDto); var reportsGroupedByVillageAndDate = await _reportsDashboardByVillageService.GetReportsGroupedByVillageAndDate(filters, filtersDto.GroupingType); var dashboardDataDto = new NationalSocietyDashboardResponseDto { Summary = await _nationalSocietyDashboardSummaryService.GetData(filters), ReportsGroupedByLocation = await _reportsDashboardMapService.GetProjectSummaryMap(filters), ReportsGroupedByVillageAndDate = reportsGroupedByVillageAndDate }; return(Success(dashboardDataDto)); }