diff --git a/app/assets/javascripts/angular/controllers/dialogs/sorting.js b/app/assets/javascripts/angular/controllers/dialogs/sorting.js index 276b08006a..fb07efd8be 100644 --- a/app/assets/javascripts/angular/controllers/dialogs/sorting.js +++ b/app/assets/javascripts/angular/controllers/dialogs/sorting.js @@ -52,6 +52,10 @@ angular.module('openproject.workPackages.controllers') return [$scope.availableColumnsData.filter(function(column) { return column.id == element.field; })[0], $scope.availableDirectionsData.filter(function(direction) { return direction.id == element.direction; })[0]] }); + + while($scope.sortElements.length < 3) { + $scope.sortElements.push([]); + } } $scope.getAvailableColumnsData = function(term, result) { @@ -63,9 +67,13 @@ angular.module('openproject.workPackages.controllers') } $scope.updateSortation = function(){ - var sortElements = $scope.sortElements.map(function(element){ - return { field: element[0].id, direction: element[1].id } - }) + var sortElements = $scope.sortElements + .filter(function(element){ + return element.length == 2; + }) + .map(function(element){ + return { field: element[0].id, direction: element[1].id } + }) QueryService.updateSortElements(sortElements); sortingModal.deactivate(); diff --git a/app/assets/javascripts/angular/services/query-service.js b/app/assets/javascripts/angular/services/query-service.js index 20e8deaa61..88a365e91b 100644 --- a/app/assets/javascripts/angular/services/query-service.js +++ b/app/assets/javascripts/angular/services/query-service.js @@ -134,7 +134,6 @@ angular.module('openproject.services') return QueryService.doGet(url, function(response){ availableColumns = response.data.available_columns; return availableColumns; -<<<<<<< HEAD }); }, @@ -147,9 +146,6 @@ angular.module('openproject.services') this.hideColumns(currentColumns.map(function(column) { return column.name; })); this.showColumns(selectedColumnNames); -======= - }) ->>>>>>> Temp solution - moved sortation watcher to wp controller. }, updateSortElements: function(sortation) {