private ReportsFilter MapToReportFilters(int nationalSocietyId, NationalSocietyDashboardFiltersRequestDto filtersDto) =>
 new ReportsFilter
 {
     StartDate         = filtersDto.StartDate,
     EndDate           = filtersDto.EndDate.AddDays(1),
     HealthRiskId      = filtersDto.HealthRiskId,
     NationalSocietyId = nationalSocietyId,
     Area = filtersDto.Area == null
             ? null
             : new Area
     {
         AreaType = filtersDto.Area.Type,
         AreaId   = filtersDto.Area.Id
     },
     DataCollectorType = MapToDataCollectorType(filtersDto.NationalSocietyReportsType),
     IsTraining        = filtersDto.IsTraining
 };
        public async Task <Result <IEnumerable <ReportsSummaryHealthRiskResponseDto> > > GetReportHealthRisks(int nationalSocietyId, double latitude, double longitude,
                                                                                                              NationalSocietyDashboardFiltersRequestDto filtersDto)
        {
            var filters = MapToReportFilters(nationalSocietyId, filtersDto);
            var data    = await _reportsDashboardMapService.GetProjectReportHealthRisks(filters, latitude, longitude);

            return(Success(data));
        }
Esempio n. 3
0
 public async Task <Result <IEnumerable <ReportsSummaryHealthRiskResponseDto> > > ReportHealthRisks(int nationalSocietyId, double latitude, double longitude,
                                                                                                    [FromBody] NationalSocietyDashboardFiltersRequestDto filters) =>
 await _nationalSocietyDashboardService.GetReportHealthRisks(nationalSocietyId, latitude, longitude, filters);
        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));
        }
Esempio n. 5
0
 public Task <Result <NationalSocietyDashboardResponseDto> > Data(int nationalSocietyId, [FromBody] NationalSocietyDashboardFiltersRequestDto dto) =>
 _nationalSocietyDashboardService.GetData(nationalSocietyId, dto);