From 66f7c4b10ab0749dc199777337dc0e2bef79e239 Mon Sep 17 00:00:00 2001 From: Mritunjay Dubey Date: Fri, 6 Dec 2019 20:41:20 +0530 Subject: [PATCH] Release latest bahmni appointments as OWA (#7) * Override appointment status handler for creator as participant scenario * Include latest bahmni appointment release --- bintray.json | 2 +- package.json | 4 ++-- src/appointmentStatusHandler.js | 11 ++++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/bintray.json b/bintray.json index ce0eb9f..46039db 100644 --- a/bintray.json +++ b/bintray.json @@ -6,7 +6,7 @@ }, "version": { - "name": "1.0.0-beta", + "name": "1.0.0", "released": "2019-11-05" }, diff --git a/package.json b/package.json index f4b340c..9f58a9d 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "openmrs-owa-bahmni-appointments", - "version": "1.0.0-beta", + "version": "1.0.0", "description": "Packages UI of bahmni appointments module as openmrs OWA", "main": "index.js", "scripts": { "clean": "rimraf ./dependencies ./appointments", - "download": "download https://github.com/Bahmni/openmrs-module-appointments-frontend/releases/download/0.0.1/openmrs-module-appointments-frontend.zip -o dependencies", + "download": "download https://github.com/Bahmni/openmrs-module-appointments-frontend/releases/download/openmrs-refapp-support-0.0.2/openmrs-module-appointments-frontend.zip -o dependencies", "unzip": "extract-zip ./dependencies/openmrs-module-appointments-frontend.zip && rm -f ./dependencies/openmrs-module-appointments-frontend.zip", "copy": "cp -r ./src/* ./dist/", "zip": "mv dist appointments && cd appointments && bestzip ../appointments-${npm_package_version}.zip *", diff --git a/src/appointmentStatusHandler.js b/src/appointmentStatusHandler.js index 7b9de9b..b146a69 100644 --- a/src/appointmentStatusHandler.js +++ b/src/appointmentStatusHandler.js @@ -47,9 +47,7 @@ Bahmni.Appointments.AppointmentStatusHandler = (function () { clone.status = getStatusForAppointment(appointment); clone.providers = _.map(clone.providers, function (provider) { - const response = (provider.uuid === currentProviderUuid) ? - providerResponses().ACCEPTED : provider.response; - return {uuid: provider.uuid, response: response}; + return {uuid: provider.uuid, response: providerResponses().ACCEPTED}; }); return clone; }; @@ -62,10 +60,9 @@ Bahmni.Appointments.AppointmentStatusHandler = (function () { clone.status = isCurrentProviderInAppointment ? appointmentStatuses().Scheduled : appointmentStatuses().Requested; + const responseForEveryProvider = isCurrentProviderInAppointment ? providerResponses().ACCEPTED : providerResponses().AWAITING; clone.providers = _.map(clone.providers, function (provider) { - const response = (provider.uuid === currentProviderUuid) ? - providerResponses().ACCEPTED : providerResponses().AWAITING; - return {uuid: provider.uuid, response: response}; + return {uuid: provider.uuid, response: responseForEveryProvider}; }); return clone; }; @@ -116,7 +113,7 @@ Bahmni.Appointments.AppointmentStatusHandler = (function () { return statusAndResponseForScheduledServices(appointment); } if (_.isEmpty(appointment.providers)) { - return {status: getStatusForAppointment(appointment), providers:[]}; + return {status: getStatusForAppointment(appointment), providers: []}; } let statusAndProviderResponse = statusAndResponseForRequestedServices(appointment, existingProvidersUuids);