RED-7854 - UI stuck when selecting a future license

- in case start date is in the future send 0 values for license report
This commit is contained in:
Corina Olariu 2023-10-31 15:39:06 +02:00
parent fcaf76eb48
commit afa75b850c

View File

@ -30,14 +30,33 @@ public class LicenseReportService {
public LicenseReport getLicenseReport(LicenseReportRequest licenseReportRequest) {
if (licenseReportRequest.getStartDate() == null || licenseReportRequest.getStartDate().isAfter(Instant.now())) {
if (licenseReportRequest.getStartDate() == null) {
throw new BadRequestException("Invalid start date.");
}
if (licenseReportRequest.getStartDate().isAfter(Instant.now())) {
return LicenseReport.builder()
.totalFilesUploadedBytes(0)
.activeFilesUploadedBytes(0)
.trashFilesUploadedBytes(0)
.archivedFilesUploadedBytes(0)
.numberOfAnalyzedPages(0)
.numberOfOcrPages(0)
.numberOfAnalyzedFiles(0)
.analysedFilesBytes(0)
.numberOfOcrFiles(0)
.numberOfDossiers(0)
.startDate(licenseReportRequest.getStartDate())
.endDate(licenseReportRequest.getEndDate())
.build();
}
if (licenseReportRequest.getStartDate().isAfter(licenseReportRequest.getEndDate())) {
throw new BadRequestException("Invalid date period: End date is before start date.");
}
var files = fileStatusService.getStatusesAddedBefore(OffsetDateTime.ofInstant(licenseReportRequest.getEndDate(), UTC_ZONE_ID));
var addDossiers = dossierService.getAllDossiers();