From f7277341223ca54b0a8bd55d8c7da917b3693fc9 Mon Sep 17 00:00:00 2001 From: Pamela Canchanya Date: Wed, 2 Apr 2014 13:49:03 -0400 Subject: [PATCH] UHM-1172 Make sure to get appointments by date and location with all statuses --- .../module/appointmentscheduling/Appointment.java | 10 +++++----- .../api/db/hibernate/HibernateAppointmentDAO.java | 2 -- .../api/AppointmentServiceTest.java | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/appointmentscheduling/Appointment.java b/api/src/main/java/org/openmrs/module/appointmentscheduling/Appointment.java index 7ec6f647..30b271d1 100644 --- a/api/src/main/java/org/openmrs/module/appointmentscheduling/Appointment.java +++ b/api/src/main/java/org/openmrs/module/appointmentscheduling/Appointment.java @@ -13,11 +13,6 @@ */ package org.openmrs.module.appointmentscheduling; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Predicate; import org.codehaus.jackson.map.annotate.JsonSerialize; @@ -28,6 +23,11 @@ import org.openmrs.Visit; import org.openmrs.module.appointmentscheduling.serialize.AppointmentStatusSerializer; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + /** * It is a model class. It should extend either {@link BaseOpenmrsObject} or * {@link BaseOpenmrsMetadata}. diff --git a/api/src/main/java/org/openmrs/module/appointmentscheduling/api/db/hibernate/HibernateAppointmentDAO.java b/api/src/main/java/org/openmrs/module/appointmentscheduling/api/db/hibernate/HibernateAppointmentDAO.java index 8e4960f9..1ee35d15 100644 --- a/api/src/main/java/org/openmrs/module/appointmentscheduling/api/db/hibernate/HibernateAppointmentDAO.java +++ b/api/src/main/java/org/openmrs/module/appointmentscheduling/api/db/hibernate/HibernateAppointmentDAO.java @@ -172,8 +172,6 @@ public List getAppointmentsByAppointmentBlockAndAppointmentTypes(Ap if (appointmentTypes != null) criteria.add(Restrictions.in("appointmentType", appointmentTypes)); - // skip cancelled and missed appointment blocks - criteria.add(Restrictions.and(Restrictions.ne("status", CANCELLED), Restrictions.ne("status", MISSED))); criteria.add(Restrictions.eq("voided", false)); return criteria.list(); diff --git a/api/src/test/java/org/openmrs/module/appointmentscheduling/api/AppointmentServiceTest.java b/api/src/test/java/org/openmrs/module/appointmentscheduling/api/AppointmentServiceTest.java index c284c359..43800ead 100644 --- a/api/src/test/java/org/openmrs/module/appointmentscheduling/api/AppointmentServiceTest.java +++ b/api/src/test/java/org/openmrs/module/appointmentscheduling/api/AppointmentServiceTest.java @@ -466,7 +466,7 @@ public void shouldGetDailyAppointments() throws Exception { ScheduledAppointmentBlock scheduledAppointmentBlock = scheduledAppointmentBlockList.get(0); - assertEquals(scheduledAppointmentBlock.getAppointments().size(), 3); + assertEquals(scheduledAppointmentBlock.getAppointments().size(), 4); assertEquals(format.parse("2014-01-02 00:00:00.0"), scheduledAppointmentBlock.getStartDate()); assertEquals(format.parse("2014-01-02 12:00:00.0"), scheduledAppointmentBlock.getEndDate()); assertEquals(provider, scheduledAppointmentBlock.getProvider()); @@ -477,7 +477,7 @@ public void shouldGetDailyAppointments() throws Exception { assertEquals("Initial HIV Clinic Appointment", appointment.getAppointmentType().getName()); appointment = appointmentList.get(1); - assertEquals(2, appointment.getPatient().getId().intValue()); + assertEquals(1, appointment.getPatient().getId().intValue()); assertEquals("Initial HIV Clinic Appointment", appointment.getAppointmentType().getName()); }