RED-7854 - UI stuck when selecting a future license

- return 0 values in all invalid cases
This commit is contained in:
Corina Olariu 2023-11-01 10:48:23 +02:00
parent 1144221f97
commit f4e1d6de0a

View File

@ -37,12 +37,13 @@ public class LicenseReportService {
public LicenseReport getLicenseReport(LicenseReportRequest licenseReportRequest) { public LicenseReport getLicenseReport(LicenseReportRequest licenseReportRequest) {
if (licenseReportRequest.getStartDate() == null || licenseReportRequest.getStartDate().isAfter(Instant.now())) { if (licenseReportRequest.getStartDate() == null ||
throw new BadRequestException("Invalid start date."); licenseReportRequest.getStartDate().isAfter(Instant.now()) ||
} licenseReportRequest.getStartDate().isAfter(licenseReportRequest.getEndDate())) {
return LicenseReport.builder()
if (licenseReportRequest.getStartDate().isAfter(licenseReportRequest.getEndDate())) { .startDate(licenseReportRequest.getStartDate())
throw new BadRequestException("Invalid date period: End date is before start date."); .endDate(licenseReportRequest.getEndDate())
.build();
} }
var files = fileStatusService.getStatusesAddedBefore(OffsetDateTime.ofInstant(licenseReportRequest.getEndDate(), UTC_ZONE_ID)); var files = fileStatusService.getStatusesAddedBefore(OffsetDateTime.ofInstant(licenseReportRequest.getEndDate(), UTC_ZONE_ID));