Skip to content

Commit

Permalink
BAH-1109 | Gopi | Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gopiyaramothu authored and rakesh-1010 committed Dec 21, 2020
1 parent 0cdea50 commit 6224711
Show file tree
Hide file tree
Showing 18 changed files with 129 additions and 177 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/node.js.yml

This file was deleted.

@@ -1,7 +1,7 @@
'use strict';

angular.module('bahmni.clinical')
.controller('PatientListHeaderController', ['$scope', '$rootScope', '$bahmniCookieStore', 'providerService', 'spinner', 'locationService', '$window', 'ngDialog', 'retrospectiveEntryService', 'offlineService', 'schedulerService', 'offlineStatusService','$http',
.controller('PatientListHeaderController', ['$scope', '$rootScope', '$bahmniCookieStore', 'providerService', 'spinner', 'locationService', '$window', 'ngDialog', 'retrospectiveEntryService', 'offlineService', 'schedulerService', 'offlineStatusService', '$http',
function ($scope, $rootScope, $bahmniCookieStore, providerService, spinner, locationService, $window, ngDialog, retrospectiveEntryService, offlineService, schedulerService, offlineStatusService, $http) {
var DateUtil = Bahmni.Common.Util.DateUtil;
$scope.maxStartDate = DateUtil.getDateWithoutTime(DateUtil.today());
Expand All @@ -14,17 +14,15 @@ angular.module('bahmni.clinical')
$scope.isSelectiveSyncStrategy = false;

var verifySelectiveSync = function () {
$http.get('/openmrs/ws/rest/v1/eventlog/filter/globalProperty/', {
$http.get('/openmrs/ws/rest/v1/eventlog/filter/globalProperty/', {
method: "GET",
params: { q: 'bahmniOfflineSync.strategy' },
withCredentials: true,
headers: { "Accept": "application/text", "Content-Type": "text/plain" }
}).then((response) => {
let value = response.data;
if (value.includes("SelectiveSyncStrategy"))
$scope.isSelectiveSyncStrategy = true;
}), function (error) {
};
if (value.includes("SelectiveSyncStrategy")) { $scope.isSelectiveSyncStrategy = true; }
});
};

offlineStatusService.setOfflineOptions();
Expand Down Expand Up @@ -66,7 +64,8 @@ angular.module('bahmni.clinical')
};

$scope.popUpHandler = function () {
$scope.dialog = ngDialog.open({ template: 'consultation/views/defaultDataPopUp.html', className: 'test ngdialog-theme-default',
$scope.dialog = ngDialog.open({ template: 'consultation/views/defaultDataPopUp.html',
className: 'test ngdialog-theme-default',
controller: 'PatientListHeaderController'});
$('body').addClass('show-controller-back');
};
Expand Down
2 changes: 1 addition & 1 deletion ui/app/common/constants.js
Expand Up @@ -255,7 +255,7 @@ Bahmni.Common = Bahmni.Common || {};
eventLogServiceConceptUrl: hostUrl + "/event-log-service/rest/eventlog/concepts",
eventLogServiceFormUrl: hostUrl + "/event-log-service/rest/eventlog/forms",
offlineMetadataUrl: hostUrl + "/offlineMetadata.json",
startArchivingURL : RESTWS_V1 + "/bahmniconnect/initSync",
startArchivingURL: RESTWS_V1 + "/bahmniconnect/initSync",
faviconUrl: hostUrl + "/bahmni/favicon.ico",
platformType: {
chrome: 'chrome',
Expand Down
6 changes: 3 additions & 3 deletions ui/app/common/offline/dbservices/dao/encounterDbService.js
Expand Up @@ -78,15 +78,15 @@ angular.module('bahmni.common.offline')
return db.delete().from(encounter).exec();
};

var getEncountersCount = function(db) {
var getEncountersCount = function (db) {
var encounter = db.getSchema().table('encounter');
return db.select(encounter.encounterJson.as('encounter'))
.from(encounter)
.where().exec()
.then(function (result) {
return result.length;
});
}
};

return {
insertEncounterData: insertEncounterData,
Expand All @@ -97,4 +97,4 @@ angular.module('bahmni.common.offline')
deleteAllEncounterRecords: deleteAllEncounterRecords,
getEncountersCount: getEncountersCount
};
});
});
Expand Up @@ -195,4 +195,4 @@ angular.module('bahmni.common.offline')
getAddressesHeirarchyLevels: getAddressesHeirarchyLevels,
getAddressesHeirarchyLevelsById: getAddressesHeirarchyLevelsById
};
}]);
}]);
28 changes: 14 additions & 14 deletions ui/app/common/offline/dbservices/dao/offlineDbService.js
Expand Up @@ -30,17 +30,17 @@ angular.module('bahmni.common.offline')
};

var getPatientByUuid = function (uuid, preferredDb) {
preferredDb = preferredDb ? preferredDb : db;
preferredDb = preferredDb || db;
return patientDbService.getPatientByUuid(preferredDb, uuid);
};

var getPatientsCount = function() {
var getPatientsCount = function () {
return patientDbService.getPatientsCount(db);
}
};

var getEncountersCount = function () {
return encounterDbService.getEncountersCount(db);
}
};

var deletePatientData = function (uuid) {
var deferred = $q.defer();
Expand Down Expand Up @@ -118,7 +118,7 @@ angular.module('bahmni.common.offline')
};

var insertEncounterData = function (encounterData, preferredDb) {
preferredDb = preferredDb ? preferredDb : db;
preferredDb = preferredDb || db;
return encounterDbService.insertEncounterData(preferredDb, encounterData).then(function () {
if (encounterData && encounterData.observations && encounterData.observations.length > 0) {
return observationDbService.insertObservationsData(preferredDb, encounterData.patientUuid, encounterData.visitUuid, encounterData.observations).then(function () {
Expand Down Expand Up @@ -246,7 +246,7 @@ angular.module('bahmni.common.offline')
};

var insertVisitData = function (visitData, preferredDb) {
preferredDb = preferredDb ? preferredDb : db;
preferredDb = preferredDb || db;
return visitDbService.insertVisitData(preferredDb, visitData);
};

Expand All @@ -255,7 +255,7 @@ angular.module('bahmni.common.offline')
};

var getEncounterByEncounterUuid = function (encounterUuid, preferredDb) {
preferredDb = preferredDb ? preferredDb : db;
preferredDb = preferredDb || db;
return encounterDbService.getEncounterByEncounterUuid(preferredDb, encounterUuid);
};

Expand All @@ -276,14 +276,14 @@ angular.module('bahmni.common.offline')
};

var insertLog = function (errorUuid, failedRequest, responseStatus, stackTrace, requestPayload) {
var provider = _.has(requestPayload, 'providers') ? requestPayload.providers[0] :
(_.has(requestPayload, 'auditInfo.creator') ? requestPayload.auditInfo.creator : "");
requestPayload = requestPayload ? requestPayload : "";
var provider = _.has(requestPayload, 'providers') ? requestPayload.providers[0]
: (_.has(requestPayload, 'auditInfo.creator') ? requestPayload.auditInfo.creator : "");
requestPayload = requestPayload || "";
return errorLogDbService.insertLog(db, errorUuid, failedRequest, responseStatus, stackTrace, requestPayload, provider);
};

var getErrorLogByUuid = function (uuid, preferredDb) {
preferredDb = preferredDb ? preferredDb : db;
preferredDb = preferredDb || db;
return errorLogDbService.getErrorLogByUuid(preferredDb, uuid);
};

Expand All @@ -292,7 +292,7 @@ angular.module('bahmni.common.offline')
};

var deleteObsByEncounterUuid = function (uuid, preferredDb) {
preferredDb = preferredDb ? preferredDb : db;
preferredDb = preferredDb || db;
return observationDbService.deleteByEncounterUuid(preferredDb, uuid);
};

Expand Down Expand Up @@ -363,8 +363,8 @@ angular.module('bahmni.common.offline')
};

var clearLastEventUuidForMarker = function (markerName) {
return offlineMarkerDbService.clearLastEventUuid(db, markerName)
}
return offlineMarkerDbService.clearLastEventUuid(db, markerName);
};

return {
init: init,
Expand Down
Expand Up @@ -35,9 +35,9 @@ angular.module('bahmni.common.offline')
});
};

var clearLastEventUuid = function(db, markerName) {
var clearLastEventUuid = function (db, markerName) {
var markerTable = db.getSchema().table('event_log_marker');
getMarkers(db, markerTable, markerName).then(function(markers) {
getMarkers(db, markerTable, markerName).then(function (markers) {
let marker = markers[0];
marker.lastReadEventUuid = null;
var row = markerTable.createRow(marker);
Expand All @@ -46,11 +46,11 @@ angular.module('bahmni.common.offline')
return marker;
});
});
}
};

return {
insertMarker: insertMarker,
getMarker: getMarker,
clearLastEventUuid: clearLastEventUuid
};
}]);
}]);
2 changes: 1 addition & 1 deletion ui/app/common/offline/dbservices/dao/patientDbService.js
Expand Up @@ -55,4 +55,4 @@ angular.module('bahmni.common.offline')
getPatientsCount: getPatientsCount,
deleteAllPatientRecords: deleteAllPatientRecords
};
});
});
Expand Up @@ -35,8 +35,7 @@ angular.module('bahmni.common.offline')
_.each(identifiers, function (identifier) {
if (!identifier.primaryIdentifier) {
queries = insertQueries(identifier, patientIdentifierTable, patientUuid, queries, db);
}
else {
} else {
var promise = db.select(patientIdentifierTable.primaryIdentifier)
.from(patientIdentifierTable)
.where(lf.op.and(patientIdentifierTable.primaryIdentifier.eq(identifier.primaryIdentifier), patientIdentifierTable.patientUuid.neq(patientUuid))).exec()
Expand All @@ -63,4 +62,4 @@ angular.module('bahmni.common.offline')
insertPatientIdentifiers: insertPatientIdentifiers,
getPatientIdentifiersByPatientUuid: getPatientIdentifiersByPatientUuid
};
}]);
}]);
2 changes: 1 addition & 1 deletion ui/app/common/offline/services/eventLogService.js
Expand Up @@ -34,7 +34,7 @@ angular.module('bahmni.common.offline')
return getEvents(Bahmni.Common.Constants.eventLogServiceEncounterUrl, marker);
case 'offline-concepts':
return getEvents(Bahmni.Common.Constants.eventLogServiceConceptUrl, marker);
//case 'parentAddressHierarchy':
// case 'parentAddressHierarchy':
case 'addressHierarchy':
return getEvents(Bahmni.Common.Constants.addressEventLogServiceUrl, marker);
case 'forms':
Expand Down

0 comments on commit 6224711

Please sign in to comment.