Search in sources :

Example 1 with DashboardDTO

use of py.org.fundacionparaguaya.pspserver.network.dtos.DashboardDTO in project FP-PSP-SERVER by FundacionParaguaya.

the class ApplicationServiceImpl method getApplicationDashboard.

@Override
public ApplicationDTO getApplicationDashboard(Long applicationId, UserDetailsDTO details) {
    ApplicationDTO dto = getUserApplication(details, applicationId);
    Long organizationId = Optional.ofNullable(details.getOrganization()).orElse(new OrganizationDTO()).getId();
    FamilyFilterDTO filter = FamilyFilterDTO.builder().applicationId(dto.getId()).organizationId(organizationId).build();
    DashboardDTO dashboard = DashboardDTO.of(familyService.countFamiliesByFilter(filter), null, null, null, snapshotService.countSnapshotTaken(filter));
    dto.setDashboard(dashboard);
    return dto;
}
Also used : ApplicationDTO(py.org.fundacionparaguaya.pspserver.network.dtos.ApplicationDTO) FamilyFilterDTO(py.org.fundacionparaguaya.pspserver.families.dtos.FamilyFilterDTO) OrganizationDTO(py.org.fundacionparaguaya.pspserver.network.dtos.OrganizationDTO) DashboardDTO(py.org.fundacionparaguaya.pspserver.network.dtos.DashboardDTO)

Example 2 with DashboardDTO

use of py.org.fundacionparaguaya.pspserver.network.dtos.DashboardDTO in project FP-PSP-SERVER by FundacionParaguaya.

the class ApplicationControllerTest method getDashboardTest.

private DashboardDTO getDashboardTest() {
    DashboardDTO dto = new DashboardDTO();
    dto.setNumberOfFamilies(new Long(1));
    dto.setActivityFeed(new ArrayList<>());
    dto.setSnapshotIndicators(new SnapshotIndicators());
    dto.setSnapshotTaken(new SnapshotTaken());
    dto.setTopOfIndicators(new ArrayList<>());
    return dto;
}
Also used : SnapshotIndicators(py.org.fundacionparaguaya.pspserver.surveys.dtos.SnapshotIndicators) SnapshotTaken(py.org.fundacionparaguaya.pspserver.surveys.dtos.SnapshotTaken) DashboardDTO(py.org.fundacionparaguaya.pspserver.network.dtos.DashboardDTO)

Example 3 with DashboardDTO

use of py.org.fundacionparaguaya.pspserver.network.dtos.DashboardDTO in project FP-PSP-SERVER by FundacionParaguaya.

the class OrganizationServiceImpl method getOrganizationDashboard.

@Override
public OrganizationDTO getOrganizationDashboard(Long organizationId, UserDetailsDTO details) {
    OrganizationDTO dto = new OrganizationDTO();
    if (details.getOrganization() != null && details.getOrganization().getId() != null) {
        dto = getOrganizationById(details.getOrganization().getId());
    } else if (organizationId != null) {
        dto = getOrganizationById(organizationId);
    }
    Long applicationId = Optional.ofNullable(details.getApplication()).orElse(new ApplicationDTO()).getId();
    FamilyFilterDTO filter = FamilyFilterDTO.builder().applicationId(applicationId).organizationId(dto.getId()).build();
    DashboardDTO dashboard = DashboardDTO.of(familyService.countFamiliesByFilter(filter), null, snapshotServiceImpl.getTopOfIndicators(organizationId), countSnapshotIndicators(organizationId), null);
    dto.setDashboard(dashboard);
    return dto;
}
Also used : ApplicationDTO(py.org.fundacionparaguaya.pspserver.network.dtos.ApplicationDTO) FamilyFilterDTO(py.org.fundacionparaguaya.pspserver.families.dtos.FamilyFilterDTO) OrganizationDTO(py.org.fundacionparaguaya.pspserver.network.dtos.OrganizationDTO) DashboardDTO(py.org.fundacionparaguaya.pspserver.network.dtos.DashboardDTO)

Aggregations

DashboardDTO (py.org.fundacionparaguaya.pspserver.network.dtos.DashboardDTO)3 FamilyFilterDTO (py.org.fundacionparaguaya.pspserver.families.dtos.FamilyFilterDTO)2 ApplicationDTO (py.org.fundacionparaguaya.pspserver.network.dtos.ApplicationDTO)2 OrganizationDTO (py.org.fundacionparaguaya.pspserver.network.dtos.OrganizationDTO)2 SnapshotIndicators (py.org.fundacionparaguaya.pspserver.surveys.dtos.SnapshotIndicators)1 SnapshotTaken (py.org.fundacionparaguaya.pspserver.surveys.dtos.SnapshotTaken)1