Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit c536d1d

Browse files
BarnaBarthabarnabartha
andauthored
SORMAS-Foundation#3424 - handle dropped contact even if it becomes dropped as a result of case classification not a contact change (SORMAS-Foundation#3785)
Co-authored-by: barnabartha <[email protected]>
1 parent 2181752 commit c536d1d

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

sormas-backend/src/main/java/de/symeda/sormas/backend/contact/ContactFacadeEjb.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,11 @@ public ContactDto saveContact(ContactDto dto, boolean handleChanges) {
308308

309309
final boolean convertedToCase =
310310
(existingContactDto == null || existingContactDto.getResultingCase() == null) && entity.getResultingCase() != null;
311-
final boolean dropped = entity.getContactStatus() == ContactStatus.DROPPED;
311+
final boolean dropped = entity.getContactStatus() == ContactStatus.DROPPED
312+
&& (existingContactDto == null || existingContactDto.getContactStatus() != ContactStatus.DROPPED);
312313
if (dropped || convertedToCase) {
313-
entity.setFollowUpStatus(FollowUpStatus.CANCELED);
314-
entity.setFollowUpComment(
314+
contactService.cancelFollowUp(
315+
entity,
315316
I18nProperties
316317
.getString(convertedToCase ? Strings.messageSystemFollowUpCanceled : Strings.messageSystemFollowUpCanceledByDropping));
317318
} else {

sormas-backend/src/main/java/de/symeda/sormas/backend/contact/ContactService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ public void udpateContactStatus(Contact contact) {
753753
break;
754754
case NO_CONTACT:
755755
contact.setContactStatus(ContactStatus.DROPPED);
756+
cancelFollowUp(contact, I18nProperties.getString(Strings.messageSystemFollowUpCanceledByDropping));
756757
break;
757758
case CONFIRMED:
758759
if (contact.getResultingCase() != null) {
@@ -863,6 +864,12 @@ public void updateFollowUpUntilAndStatus(Contact contact) {
863864
ensurePersisted(contact);
864865
}
865866

867+
public void cancelFollowUp(Contact contact, String comment) {
868+
contact.setFollowUpStatus(FollowUpStatus.CANCELED);
869+
contact.setFollowUpComment(comment);
870+
ensurePersisted(contact);
871+
}
872+
866873
// Used only for testing; directly retrieve the contacts from the visit instead
867874
public List<Contact> getAllByVisit(Visit visit) {
868875

0 commit comments

Comments
 (0)