appstore: fix ordering of apps

all apps: alphabetical
popular: based on ranking instead of installCount
New Apps: based on time only
Category: tag and then ranking
This commit is contained in:
Girish Ramakrishnan
2020-07-17 14:19:25 -07:00
parent 0043b3690a
commit 4f4df7d9fe
2 changed files with 5 additions and 5 deletions

View File

@@ -455,17 +455,17 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
if (error) return $timeout($scope.showCategory.bind(null, category), 1000);
if (!$scope.category) {
$scope.apps = apps;
$scope.apps = apps.slice(0).sort(function (a1, a2) { return a1.manifest.title.localeCompare(a2.manifest.title); });
} else if ($scope.category === 'featured') {
$scope.apps = apps.filter(function (app) { return app.featured; });
$scope.apps = apps.filter(function (app) { return app.featured; }).sort(function (a1, a2) { return a2.ranking - a1.ranking; }); // reverse sort
} else if ($scope.category === 'new') {
$scope.apps = filterForNewApps(apps);
} else if ($scope.category === 'recent') {
$scope.apps = filterForRecentlyUpdatedApps(apps);
} else {
$scope.apps = apps.filter(function (app) {
return app.manifest.tags.some(function (tag) { return $scope.category === tag; });
});
return app.manifest.tags.some(function (tag) { return $scope.category === tag; }); // reverse sort;
}).sort(function (a1, a2) { return a2.ranking - a1.ranking; });
}
// ensure we scroll to top