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

"Sreelekha,Sri Laxmi , Samyuktha | BAH-4105 | Form name/number to not be displayed on patient dashboard display control" #1021

Merged
merged 4 commits into from
Jan 6, 2025
Merged
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
rahu1ramesh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
'use strict';

angular.module('bahmni.common.displaycontrol.observation')
.service('formRecordTreeBuildService', ['formService', '$window', function (formService, $window) {
.service('formRecordTreeBuildService', ['formService', '$window', 'appService', function (formService, $window, appService) {
var self = this;
self.formBuildForms = [];
self.build = function (bahmniObservations, hasNoHierarchy) {
_.forEach(bahmniObservations, function (obs) {
obs.value = self.preProcessMultiSelectObs(obs.value);
});

formService.getAllForms().then(function (response) {
var formBuildForms = response.data;
var obs = self.createObsGroupForForm(bahmniObservations, formBuildForms);
if (!hasNoHierarchy) {
updateObservationsWithFormDefinition(obs, formBuildForms);
}
});
if (!appService.getAppDescriptor().getConfigValue('hideFormName')) {
formService.getAllForms().then(function (response) {
var formBuildForms = response.data;
var obs = self.createObsGroupForForm(bahmniObservations, formBuildForms);
if (!hasNoHierarchy) {
updateObservationsWithFormDefinition(obs, formBuildForms);
}
});
}
};

self.createMultiSelectObservation = function (observations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,29 @@ describe("FormRecordTreeBuildService", function () {
var allFormsDeferred;
var formTranslateDeferred;
var formTranslationsDetails;
var appService = jasmine.createSpyObj('appService', ['getAppDescriptor']);

var mockAppDescriptor = jasmine.createSpyObj('appService', ['getConfigValue']);
mockAppDescriptor.getConfigValue.and.returnValue(undefined);

var mockAppService = jasmine.createSpyObj('appDescriptor', ['getAppDescriptor']);
mockAppService.getAppDescriptor.and.returnValue(mockAppDescriptor);

beforeEach(module("bahmni.common.displaycontrol.observation"));
beforeEach(inject(function (_formRecordTreeBuildService_, _$q_, _$rootScope_, _formService_) {
beforeEach(function () {
appService.getAppDescriptor.and.returnValue({
getConfigValue: function (key) {
if (key === 'hideFormName') {
return false;
}
}
});

module(function ($provide) {
$provide.value('appService', appService);
});

inject(function (_formRecordTreeBuildService_, _$q_, _$rootScope_, _formService_) {
formRecordTreeBuildService = _formRecordTreeBuildService_;
formService = _formService_;
$q = _$q_;
Expand Down Expand Up @@ -105,7 +125,8 @@ describe("FormRecordTreeBuildService", function () {
formDetailDeferred = $q.defer();
allFormsDeferred = $q.defer();
formTranslateDeferred = $q.defer();
}));
});
});

it("should construct obs group for single observation from form", function () {
var obsOne = {
Expand Down
Loading