Skip to content

Commit

Permalink
condition added to check if slotstart time is after current time (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalai-tw authored Feb 7, 2024
1 parent 7d0b4bc commit 0caa4a8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.openmrs.module.ipd.api.model.Slot;
import org.openmrs.module.ipd.model.DrugOrderSchedule;

import java.time.LocalDateTime;
import java.util.List;

@Getter
Expand All @@ -27,7 +28,7 @@ public static DrugOrderScheduleResponse createFrom(DrugOrderSchedule drugOrderSc
remainingDaySlotsStartTime(drugOrderSchedule.getRemainingDaySlotsStartTime()).
slotStartTime(drugOrderSchedule.getSlotStartTime()).
medicationAdministrationStarted(drugOrderSchedule.getSlots().stream().anyMatch(slot -> slot.getMedicationAdministration() != null)).
pendingSlotsAvailable(drugOrderSchedule.getSlots().stream().anyMatch(slot -> slot.getStatus().equals(Slot.SlotStatus.SCHEDULED))).
pendingSlotsAvailable(drugOrderSchedule.getSlots().stream().anyMatch(slot -> (LocalDateTime.now().isAfter(slot.getStartDateTime()) && slot.getStatus().equals(Slot.SlotStatus.SCHEDULED)))).
notes(drugOrderSchedule.getSlots().get(0).getNotes()).
build();
}
Expand Down

0 comments on commit 0caa4a8

Please sign in to comment.