Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-3952 | Refactor bed management. use location uuid instead of parentLocation uuid #990

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ui/app/bedmanagement/controllers/bedManagementController.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ angular.module('bahmni.ipd')

var getWardDetails = function (department) {
return _.filter($scope.wards, function (entry) {
return entry.ward.uuid === department.uuid;
if (entry.ward.uuid === department.uuid) {
return true;
}

return entry.ward.childLocations.some(function (child) {
return child.uuid === department.uuid;
});
});
};

Expand Down
4 changes: 2 additions & 2 deletions ui/app/common/domain/services/bedService.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ angular.module('bahmni.common.domain')
if (!_.isEmpty(results)) {
var bed = _.first(results);
return {
'wardName': bed.physicalLocation.parentLocation.display,
'wardUuid': bed.physicalLocation.parentLocation.uuid,
'wardName': bed.physicalLocation.display,
'wardUuid': bed.physicalLocation.uuid,
'physicalLocationName': bed.physicalLocation.name,
'bedNumber': bed.bedNumber,
'bedId': bed.bedId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ describe('BedManagementController', function () {
uuid: "some uuid",
rooms: [
{beds: [], name: "ROOM1", totalBeds: 2, availableBeds: 1}
]
],
childLocations: []
}
},
{
occupiedBeds: 0,
totalBeds: 10,
ward: {}
ward: {
childLocations: []
}
}
]
};
Expand Down
10 changes: 6 additions & 4 deletions ui/test/unit/common/domain/services/bedService.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ describe("bedService",function () {
results:[{
physicalLocation:{
name:'Physical Location Name',
uuid: 'Labour Ward uuid',
display:'Labour Ward',
parentLocation:{
display:'Labour Ward',
uuid:'Labour Ward uuid'
uuid:'Parent Location Uuid'
}
},
bedNumber:'314-a',
Expand Down Expand Up @@ -63,9 +64,10 @@ describe("bedService",function () {
results:[{
physicalLocation:{
name:'Physical Location Name',
uuid: 'Labour Ward uuid',
display:'Labour Ward',
parentLocation:{
display:'Labour Ward',
uuid:'Labour Ward uuid'
uuid:'Parent Location Uuid'
}
},
bedNumber:'314-a',
Expand Down
Loading