Weekends Missing on calender When selecting appointment date

When AddPatientAppointmentTest runs on Saturday or Sunday, it fails because it is set to choose the current day as the appointment date, and in this case, weekend days are not on the calendar so it fails .

We considered options of adding the weekend days on the calendar(but how) since there are hospitals that work on weekends or have to change the test to choose any other days but weekends

Any suggestions on how to fix this are welcome @k.joseph @kdaud @sharif @herbert24 @irenyak1 @jwnasambu

1 Like

Thanks @insookwa for bringing this, i think initially appointments was designed to be catered for only weekdays thats why calendar stops on only friday, However i like the opinion of extending the calendar use functionality to cater for weekend days(saturday and sunday) as well probably since some hospitals work on weekends, good Approach.

Am also thinking that , we also need to make sure the driver picks the appointment date not current date, after an appointment is being created , Then there is also an element of the driver picking only the current date without checking the service, so it checks the current date without searching for the service by default then it will only pick the service of current date , however when the driver first searches for the service especially searching the service of the appointment you had created, then the date of the exact appointment there is catered, so its two way around .

currently it only picks the current date by default which is why even on sunday or saturdays the automation might fail since they are not part of the calendar. Looking forward to hear from other suggestions,. cc @k.joseph @ibacher @dkayiwa

1 Like

I actually had the same view at some point but @k.joseph advised that the Appointments were designed to be done only on week days. However like @sharif said, we need to make the automation pick only the day of the appointment and not the current day. Could this be of help to you @insookwa ?

2 Likes

I would suggest that this isn’t a bug but rather a feature. More specifically, there’s a global property called appointmentschedulingui.includeWeekends which defaults to false and which controls whether or not it’s possible to create an appointment on the weekend. Thus, instead of trying to fix the module, what ought to be done is to fix the test from using a function called clickOnCurrentDay() to using something called clickOnNextWeekday() or similar.

4 Likes

Thanks alot for your quick explanation, it have solved the issue quickly :slightly_smiling_face:

Thank you @ibacher . This looks ultimate for this issue

it’s absolutely of help Thanks a lot @irenyak1 and @sharif

I am trying to call this property and set it to true before the test runs and set it back to false when the test is done by using this method

    public void IncludeWeekendsIncalender(String value) {
        AdministrationService weekends =  Context.getAdministrationService();
    	Properties properties = new Properties();
    	properties.put("appointmentschedulingui.includeWeekends",weekends.getGlobalProperty("appointmentschedulingui.includeWeekends",value));
    }

and later call in @before by

        IncludeWeekendsIncalender("true");

and after with

IncludeWeekendsIncalender("false");

but on running I am getting this error here

i imported

import org.openmrs.api.AdministrationService;
import org.openmrs.api.context.Context;

is there something missing for a successful run

@ibacher @k.joseph @kdaud @sharif

You will definitely need to read through our code conventions in the first place

You should rather be using

instead

1 Like

Hello @insookwa Have you tried reproducing this on qa by changing the appointmentshcedulingglobalProperty to True, Checkout on qa https://qa-refapp.openmrs.org/openmrs/adminui/systemadmin/globalproperties/manageGlobalProperties.page#/list

currently they are by default set to false, in otherwords you wont be able to see the weekend days, Another Option might be create a simple automation method reference that will activate weekend days by simply changing appointmentschedulingui.includeWeekends to true, and try calling it in your methods

1 Like