dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38331
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19530: some clean up in tracker rules engine
------------------------------------------------------------
revno: 19530
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-07-02 09:19:49 +0200
message:
some clean up in tracker rules engine
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators-section.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-07-01 06:24:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-07-02 07:19:49 +0000
@@ -105,8 +105,6 @@
$scope.resetOu = false;
$scope.selectedProgramStage = null;
- $scope.programValidations = [];
- $scope.programIndicators = [];
$scope.allProgramRules = [];
$scope.dhis2Events = [];
$scope.currentEvent = {};
@@ -194,13 +192,10 @@
$scope.newDhis2Event.coordinate = {};
}
$scope.newDhis2Event.eventDate = '';
-
- MetaDataFactory.getByProgram('programIndicators', $scope.selectedProgram.id).then(function(pis){
- $scope.programIndicators = pis;
- TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){
- $scope.allProgramRules = rules;
- $scope.loadEvents();
- });
+
+ TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){
+ $scope.allProgramRules = rules;
+ $scope.loadEvents();
});
});
}
@@ -958,7 +953,7 @@
$scope.eventsByStage[$scope.selectedProgramStage.id] = [$scope.currentEvent];
var evs = {all: [$scope.currentEvent], byStage: $scope.eventsByStage};
- var flag = {debug: true, verbose: true};
+ var flag = {debug: true, verbose: false};
//TrackerRulesExecutionService.executeRules($scope.selectedProgram.id,$scope.currentEvent,$scope.eventsByStage,$scope.prStDes,null,false);
TrackerRulesExecutionService.executeRules($scope.allProgramRules, $scope.currentEvent, evs, $scope.prStDes, $scope.selectedTei, $scope.selectedEnrollment, flag);
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2015-07-01 06:24:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2015-07-02 07:19:49 +0000
@@ -320,33 +320,8 @@
})
/* Returns a function for getting rules for a specific program */
-.factory('TrackerRulesFactory', function($q,$rootScope,ECStorageService, MetaDataFactory){
+.factory('TrackerRulesFactory', function($q,MetaDataFactory){
return{
- getProgramStageRules : function(programUid, programStageUid){
- var def = $q.defer();
-
- ECStorageService.currentStore.open().done(function(){
- ECStorageService.currentStore.getAll('programRules').done(function(rules){
- //The array will ultimately be returned to the caller.
- var programRulesArray = [];
- //Loop through and add the rules belonging to this program and program stage
- angular.forEach(rules, function(rule){
- if(rule.program.id === programUid) {
- if(!rule.programStage || !rule.programStage.id || rule.programStage.id === programStageUid) {
- rule.actions = [];
- programRulesArray.push(rule);
- }
- }
- });
-
- $rootScope.$apply(function(){
- def.resolve(programRulesArray);
- });
- });
- });
-
- return def.promise;
- },
getRules : function(programUid){
var def = $q.defer();
MetaDataFactory.getAll('constants').then(function(constants) {
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-06-22 08:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-07-02 07:19:49 +0000
@@ -409,6 +409,6 @@
</div>
-<div ng-if="programIndicators.length > 0" ng-include="'views/indicators-section.html'"></div>
+<div ng-if="allProgramRules.programIndicators.rules && allProgramRules.programIndicators.rules.length > 0" ng-include="'views/indicators-section.html'"></div>
<div ng-include="'views/comments-section.html'"></div>
<div ng-include="'views/buttons-section.html'"></div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html 2015-06-22 08:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html 2015-07-02 07:19:49 +0000
@@ -59,6 +59,6 @@
</tr>
</table>
<div ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div>
-<div ng-if="programIndicators.length > 0" ng-include="'views/indicators-section.html'"></div>
+<div ng-if="allProgramRules.programIndicators.rules && allProgramRules.programIndicators.rules.length > 0" ng-include="'views/indicators-section.html'"></div>
<div ng-include="'views/comments-section.html'" style="width: 50%;"></div>
<div ng-include="'views/buttons-section.html'"></div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators-section.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators-section.html 2015-06-22 08:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/indicators-section.html 2015-07-02 07:19:49 +0000
@@ -2,7 +2,7 @@
{{'indicators' | translate}}
</div>
<table class="dhis2-list-table-striped">
- <tr ng-repeat="pid in programIndicators">
+ <tr ng-repeat="pid in allProgramRules.programIndicators.rules">
<td>
{{pid.name}}
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-07-01 06:24:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-07-02 07:19:49 +0000
@@ -1099,33 +1099,8 @@
})
/* Returns a function for getting rules for a specific program */
-.factory('TrackerRulesFactory', function($q,$rootScope,TCStorageService, MetaDataFactory){
- return{
- getProgramStageRules : function(programUid, programStageUid){
- var def = $q.defer();
-
- TCStorageService.currentStore.open().done(function(){
- TCStorageService.currentStore.getAll('programRules').done(function(rules){
- //The array will ultimately be returned to the caller.
- var programRulesArray = [];
- //Loop through and add the rules belonging to this program and program stage
- angular.forEach(rules, function(rule){
- if(rule.program.id === programUid) {
- if(!rule.programStage || !rule.programStage.id || rule.programStage.id === programStageUid) {
- rule.actions = [];
- programRulesArray.push(rule);
- }
- }
- });
-
- $rootScope.$apply(function(){
- def.resolve(programRulesArray);
- });
- });
- });
-
- return def.promise;
- },
+.factory('TrackerRulesFactory', function($q,MetaDataFactory){
+ return{
getRules : function(programUid){
var def = $q.defer();
MetaDataFactory.getAll('constants').then(function(constants) {