Skip to content
Draft
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
13 changes: 4 additions & 9 deletions components/home/lists/lists-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@
}
$scope.showCustomWorkingListInline = false;
$scope.currentTrackedEntityList = { type: type, config: config, data: data };
if(!$scope.currentTrackedEntityList.sortColumn){
$scope.currentTrackedEntityList.sortColumn = {
id: 'created',
direction: 'desc',
}
}
}

var setCurrentTrackedEntityListData = function(serverResponse){
Expand All @@ -201,7 +195,7 @@



$scope.fetchTeis = function(pager, sortColumn){
$scope.fetchTeis = function(pager){
var s = 1;
if($scope.currentTrackedEntityList){
if($scope.currentTrackedEntityList.type === $scope.trackedEntityListTypes.CUSTOM){
Expand Down Expand Up @@ -395,11 +389,12 @@
sortedTei = sortedTei.concat(data.rows.other);
}
sortedTei = $filter('orderBy')(sortedTei, function(tei) {
var id = $scope.currentTrackedEntityList.sortColumn ? $scope.currentTrackedEntityList.sortColumn.id : 'created';

Check failure on line 392 in components/home/lists/lists-controller.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unexpected var, use let or const instead.

See more on https://sonarcloud.io/project/issues?id=dhis2_tracker-capture-app&issues=AZ70IvYbst4krvv_7UeU&open=AZ70IvYbst4krvv_7UeU&pullRequest=2140
if($scope.currentTrackedEntityList.sortColumn && $scope.currentTrackedEntityList.sortColumn.valueType === 'date'){
var d = tei[$scope.currentTrackedEntityList.sortColumn.id];
var d = tei[id];

Check failure on line 394 in components/home/lists/lists-controller.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unexpected var, use let or const instead.

See more on https://sonarcloud.io/project/issues?id=dhis2_tracker-capture-app&issues=AZ70IvYbst4krvv_7UeV&open=AZ70IvYbst4krvv_7UeV&pullRequest=2140
return DateUtils.getDate(d);
}
return tei[$scope.currentTrackedEntityList.sortColumn.id];
return tei[id];
}, $scope.currentTrackedEntityList.direction == 'desc');

angular.forEach(sortedTei, function(tei){
Expand Down
30 changes: 10 additions & 20 deletions scripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -2746,7 +2746,7 @@
}
return eventUrl;
}
var getCachedMultipleEventFiltersData = function(workingList, pager, sortColumn){
var getCachedMultipleEventFiltersData = function(workingList, pager){
var cachedData = cachedMultipleEventFiltersData[workingList.name];
if(!pager) pager = { page: 1, pageSize: 50, pageCount: Math.ceil(cachedData.rows.length/50)};
var pageEnd = (pager.pageSize*pager.page);
Expand Down Expand Up @@ -2793,13 +2793,15 @@
existing[d[0]] = true;
return true;
});
var sortColumnIndex = data.headers.findIndex(function(h){ return h.name === sortColumn.id});
if(sortColumnIndex) data.rows = orderByKeyFilter(data.rows, sortColumnIndex, sortColumn.direction);
if (sortColumn) {
var sortColumnIndex = data.headers.findIndex(function(h){ return h.name === sortColumn.id});
if(sortColumnIndex) data.rows = orderByKeyFilter(data.rows, sortColumnIndex, sortColumn.direction);
}
//order list
cachedMultipleEventFiltersData[workingList.name] = data;
workingList.cachedSorting = searchParams.sortUrl;
workingList.cachedOrgUnit = searchParams.orgUnitId;
var data = getCachedMultipleEventFiltersData(workingList, pager, sortColumn);
var data = getCachedMultipleEventFiltersData(workingList, pager);

Check failure on line 2804 in scripts/services.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unexpected var, use let or const instead.

See more on https://sonarcloud.io/project/issues?id=dhis2_tracker-capture-app&issues=AZ70Ivbost4krvv_7UeW&open=AZ70Ivbost4krvv_7UeW&pullRequest=2140

Check warning on line 2804 in scripts/services.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'data' is already defined.

See more on https://sonarcloud.io/project/issues?id=dhis2_tracker-capture-app&issues=AZ70Ivbost4krvv_7UeX&open=AZ70Ivbost4krvv_7UeX&pullRequest=2140
def.resolve(data);
});
}
Expand Down Expand Up @@ -3011,25 +3013,13 @@
}
}
else{
numberOfSetAttributes++;
filteredAttributes[attr.id] = true;
if(query.url){
numberOfSetAttributes++;
filteredAttributes[attr.id] = true;
if(attr.operator === textOperators[0]){
query.url = query.url + '&attribute=' + attr.id + ':EQ:' + value;
}else{
query.url = query.url + '&attribute=' + attr.id + ':LIKE:' + value;
}

query.url = query.url + '&attribute=' + attr.id + ':EQ:' + value;
}
else{
numberOfSetAttributes++;
filteredAttributes[attr.id] = true;
if(attr.operator === textOperators[0]){
query.url = 'attribute=' + attr.id + ':EQ:' + value;
}else{
query.url = 'attribute=' + attr.id + ':LIKE:' + value;
}

query.url = 'attribute=' + attr.id + ':EQ:' + value;
}
}
}
Expand Down