diff --git a/app/filters/dashboardServicesFilter.js b/app/filters/dashboardServicesFilter.js index ed9688d6..4d78bf95 100644 --- a/app/filters/dashboardServicesFilter.js +++ b/app/filters/dashboardServicesFilter.js @@ -14,9 +14,30 @@ app.filter('dashboardServices', function () { return resultingArr; }; + var filterByStatus = function (arr, filterStatus) { + var filtered = []; + var remaining = []; + + angular.forEach(arr, function (el) { + if (el.status === filterStatus) { + filtered.push(el); + } + else { + remaining.push(el); + } + }); + + return { + 'filtered': filtered, + 'remaining': remaining + }; + }; + return function (services, options) { var shownServices = reduceArray(services, options.showPublic(), "isPublic"); - return reduceArray(shownServices, options.showShortList, "onShortList"); + var byStatus = filterByStatus(shownServices, "MAINTENANCE"); + var shortList = reduceArray(byStatus.remaining, options.showShortList, "onShortList"); + return byStatus.filtered.concat(shortList); }; -}); \ No newline at end of file +});