Skip to content

Commit

Permalink
Abinaya | fix. results of default list view (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
abinaya-u authored and Phanindra-tw committed Mar 5, 2024
1 parent 524daa5 commit 3ef8d2b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/controllers/manage/list/appointmentsListViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ angular.module('bahmni.appointments')
};

var setAppointments = function (params) {
const prefilledPatient = $location.search()['patient'];
autoRefreshStatus = false;
if($scope.getCurrentTabName() === APPOINTMENTS_TAB_NAME && $state.params.patient != null)
if($scope.getCurrentTabName() === APPOINTMENTS_TAB_NAME && !prefilledPatient){
return appointmentsService.getAllAppointments(params)
.then((response) => updateAppointments(response));
}
else
return appointmentsService.search( $location.search()['patient'] ? { patientUuid: $location.search()['patient'] } : APPOINTMENT_STATUS_WAITLIST)
return appointmentsService.search( prefilledPatient ? { patientUuid: prefilledPatient } : APPOINTMENT_STATUS_WAITLIST)
.then((response) => updateAppointments(response));
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ describe('AppointmentsListViewController', function () {
controller = $controller;
stateparams = $stateParams;
_appointmentsFilter = jasmine.createSpy('appointmentsFilter');
appointmentsService = jasmine.createSpyObj('appointmentsService', ['getAllAppointments', 'changeStatus', 'undoCheckIn', 'changeProviderResponse' , 'search']);
appointmentsService = jasmine.createSpyObj('appointmentsService', ['getAllAppointments', 'changeStatus', 'undoCheckIn', 'changeProviderResponse']);
appointmentsService.getAllAppointments.and.returnValue(specUtil.simplePromise({}));
appointmentsService.search.and.returnValue(specUtil.simplePromise({}));
appService = jasmine.createSpyObj('appService', ['getAppDescriptor']);
appDescriptor = jasmine.createSpyObj('appDescriptor', ['getConfigValue']);
printer = jasmine.createSpyObj('printer', ['print']);
Expand Down Expand Up @@ -115,7 +114,6 @@ describe('AppointmentsListViewController', function () {
createController();
var viewDate = new Date('1970-01-01T11:30:00.000Z');
$state.params = {doFetchAppointmentsData: true};
$state.params.patient = '123';
scope.getAppointmentsForDate(viewDate);
expect(stateparams.viewDate).toEqual(viewDate);
expect(appointmentsService.getAllAppointments).toHaveBeenCalledWith({forDate: viewDate});
Expand Down Expand Up @@ -244,7 +242,7 @@ describe('AppointmentsListViewController', function () {
stateparams.filterParams = {serviceUuids: ["02666cc6-5f3e-4920-856d-ab7e28d3dbdb"]};
createController();
var viewDate = new Date('2017-08-28T11:30:00.000Z');
$state.params = {doFetchAppointmentsData: true , patient: "123"};
$state.params = {doFetchAppointmentsData: true};
scope.getAppointmentsForDate(viewDate);
expect(scope.appointments).toBe(appointments);
expect(scope.filteredAppointments.length).toEqual(1);
Expand Down

0 comments on commit 3ef8d2b

Please sign in to comment.