Skip to content

Commit

Permalink
Check we are actually sorted by group
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupert Bedford committed Jun 8, 2016
1 parent af74afb commit 614d225
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/app/patients/patient-list.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@
function update() {
$scope.groups = getGroups($scope.filters);

// Check if we are still filtering against the sorted group
var found = _.some($scope.groups, function(group) {
return 'group' + group.id === proxy.getSortBy();
});

// Use the default ordering if we are no longer filtering by the sorted group
if (!found) {
proxy.sort('id', true, false);
// Sorted by group
if (proxy.getSortBy().indexOf('group') === 0) {
// Check if we are still filtering against the sorted group
var found = _.some($scope.groups, function(group) {
return 'group' + group.id === proxy.getSortBy();
});

// Use the default ordering if we are no longer filtering by the sorted group
if (!found) {
proxy.sort('id', true, false);
}
}

var proxyParams = proxy.getParams();
Expand Down

0 comments on commit 614d225

Please sign in to comment.