Skip to content

Commit

Permalink
#000 | Avoid NoSuchElementException when address is not specified dur…
Browse files Browse the repository at this point in the history
…ing subject create
  • Loading branch information
himeshr committed Apr 3, 2023
1 parent 12251b1 commit e56ef4d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ private Individual updateSubject(Individual subject, ApiSubjectRequest request)
}
subject.setRegistrationDate(request.getRegistrationDate());
ObservationCollection observations = RequestUtils.createObservations(request.getObservations(), conceptRepository);
subjectMigrationService.markSubjectMigrationIfRequired(subject.getUuid(), addressLevel.get(), observations);
subject.setAddressLevel(addressLevel.get());
AddressLevel newAddressLevel = addressLevel.isPresent() ? addressLevel.get() : null;
subjectMigrationService.markSubjectMigrationIfRequired(subject.getUuid(), newAddressLevel, observations);
subject.setAddressLevel(newAddressLevel);
if (subjectType.isPerson()) {
subject.setDateOfBirth(request.getDateOfBirth());
subject.setGender(genderRepository.findByName(request.getGender()));
Expand Down

0 comments on commit e56ef4d

Please sign in to comment.