Skip to content

Commit

Permalink
fix: orchard null bec zone code and draft timestamp (#1477)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigyu authored Aug 2, 2024
1 parent f5ac5f8 commit 9332655
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,16 @@ public Optional<OrchardDto> findNotRetiredOrchardValidLotType(String id) {
}

List<String> bacZones = new ArrayList<>(1);
bacZones.add(orchardEntity.getBecZoneCode());
if (orchardEntity.getBecZoneCode() != null) {
bacZones.add(orchardEntity.getBecZoneCode());
}

Map<String, String> becZoneDescMap =
sparBecCatalogueService.getBecDescriptionsByCode(bacZones);

String becZoneDescription =
becZoneDescMap.isEmpty() ? null : becZoneDescMap.get(orchardEntity.getBecZoneCode());

OrchardDto orchardDto =
new OrchardDto(
orchardEntity.getId(),
Expand All @@ -75,7 +81,7 @@ public Optional<OrchardDto> findNotRetiredOrchardValidLotType(String id) {
orchardLotTypeCode.getDescription(),
orchardEntity.getStageCode(),
orchardEntity.getBecZoneCode(),
becZoneDescMap.get(orchardEntity.getBecZoneCode()),
becZoneDescription,
orchardEntity.getBecSubzoneCode(),
orchardEntity.getVariant(),
orchardEntity.getBecVersionId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public class SparBecCatalogueService {
* null.
*/
public Map<String, String> getBecDescriptionsByCode(List<String> 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");
Expand Down

0 comments on commit 9332655

Please sign in to comment.