From 68d608c8cd9f42497a42e41b834562c6a53f8469 Mon Sep 17 00:00:00 2001 From: Chi Bong Ho Date: Fri, 22 Mar 2024 13:40:41 -0400 Subject: [PATCH] refactor if statement --- .../openmrs/module/queue/api/impl/QueueEntryServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/openmrs/module/queue/api/impl/QueueEntryServiceImpl.java b/api/src/main/java/org/openmrs/module/queue/api/impl/QueueEntryServiceImpl.java index e73c1b1..1379150 100644 --- a/api/src/main/java/org/openmrs/module/queue/api/impl/QueueEntryServiceImpl.java +++ b/api/src/main/java/org/openmrs/module/queue/api/impl/QueueEntryServiceImpl.java @@ -257,11 +257,14 @@ private void endQueueEntry(@NotNull QueueEntry queueEntry) { @Transactional(readOnly = true) public QueueEntry getPreviousQueueEntry(@NotNull QueueEntry queueEntry) { Queue queueComingFrom = queueEntry.getQueueComingFrom(); + if(queueComingFrom == null) { + return null; + } QueueEntrySearchCriteria criteria = new QueueEntrySearchCriteria(); criteria.setPatient(queueEntry.getPatient()); criteria.setVisit(queueEntry.getVisit()); criteria.setEndedOn(queueEntry.getStartedAt()); - criteria.setQueues(queueComingFrom == null ? Arrays.asList() : Arrays.asList(queueComingFrom)); + criteria.setQueues(Arrays.asList(queueComingFrom)); List prevQueueEntries = dao.getQueueEntries(criteria); if (prevQueueEntries.size() == 1) { return prevQueueEntries.get(0);