From 9332655db82c341142b28159c8d51ae057a8d731 Mon Sep 17 00:00:00 2001 From: Craig Yu Date: Fri, 2 Aug 2024 13:24:29 -0700 Subject: [PATCH] fix: orchard null bec zone code and draft timestamp (#1477) --- .../service/SaveSeedlotFormService.java | 4 ++++ .../ca/bc/gov/oracleapi/service/OrchardService.java | 10 ++++++++-- .../gov/oracleapi/service/SparBecCatalogueService.java | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/ca/bc/gov/backendstartapi/service/SaveSeedlotFormService.java b/backend/src/main/java/ca/bc/gov/backendstartapi/service/SaveSeedlotFormService.java index 14827a377..39a043c9a 100644 --- a/backend/src/main/java/ca/bc/gov/backendstartapi/service/SaveSeedlotFormService.java +++ b/backend/src/main/java/ca/bc/gov/backendstartapi/service/SaveSeedlotFormService.java @@ -86,6 +86,10 @@ public RevisionCountDto saveFormClassA( entityToSave.setProgressStatus(parsedProgressStatus); } + relatedSeedlot.setAuditInformation(loggedUserService.createAuditCurrentUser()); + + seedlotRepository.save(relatedSeedlot); + SaveSeedlotProgressEntityClassA saved = saveSeedlotProgressRepositoryClassA.save(entityToSave); SparLog.info("A-class seedlot progress for seedlot number {} saved!", seedlotNumber); diff --git a/oracle-api/src/main/java/ca/bc/gov/oracleapi/service/OrchardService.java b/oracle-api/src/main/java/ca/bc/gov/oracleapi/service/OrchardService.java index 1a2f68a1f..74cb5ec3d 100644 --- a/oracle-api/src/main/java/ca/bc/gov/oracleapi/service/OrchardService.java +++ b/oracle-api/src/main/java/ca/bc/gov/oracleapi/service/OrchardService.java @@ -62,10 +62,16 @@ public Optional findNotRetiredOrchardValidLotType(String id) { } List bacZones = new ArrayList<>(1); - bacZones.add(orchardEntity.getBecZoneCode()); + if (orchardEntity.getBecZoneCode() != null) { + bacZones.add(orchardEntity.getBecZoneCode()); + } + Map becZoneDescMap = sparBecCatalogueService.getBecDescriptionsByCode(bacZones); + String becZoneDescription = + becZoneDescMap.isEmpty() ? null : becZoneDescMap.get(orchardEntity.getBecZoneCode()); + OrchardDto orchardDto = new OrchardDto( orchardEntity.getId(), @@ -75,7 +81,7 @@ public Optional findNotRetiredOrchardValidLotType(String id) { orchardLotTypeCode.getDescription(), orchardEntity.getStageCode(), orchardEntity.getBecZoneCode(), - becZoneDescMap.get(orchardEntity.getBecZoneCode()), + becZoneDescription, orchardEntity.getBecSubzoneCode(), orchardEntity.getVariant(), orchardEntity.getBecVersionId()); diff --git a/oracle-api/src/main/java/ca/bc/gov/oracleapi/service/SparBecCatalogueService.java b/oracle-api/src/main/java/ca/bc/gov/oracleapi/service/SparBecCatalogueService.java index 4e200b3a0..228074aeb 100644 --- a/oracle-api/src/main/java/ca/bc/gov/oracleapi/service/SparBecCatalogueService.java +++ b/oracle-api/src/main/java/ca/bc/gov/oracleapi/service/SparBecCatalogueService.java @@ -21,7 +21,8 @@ public class SparBecCatalogueService { * null. */ public Map getBecDescriptionsByCode(List becZoneCodes) { - SparLog.info("Begin service request to find the description of a given BEC zone code"); + SparLog.info( + "Begin service request to find the description of a given BEC zone code {}", becZoneCodes); if (becZoneCodes.isEmpty()) { SparLog.info("No BEC Zone code param, returning empty values for BEC zone descriptions");