From 67514ea5cb47ba31b33611df04cdc5a0b4a4a141 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Tue, 24 Sep 2013 19:01:44 +0100 Subject: [PATCH] Show percentiles for download counts on individual package pages --- html/js/melpa.js | 2 ++ html/partials/package.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/html/js/melpa.js b/html/js/melpa.js index af688368..17beca31 100644 --- a/html/js/melpa.js +++ b/html/js/melpa.js @@ -117,6 +117,8 @@ $scope.allPackages = pkgs; $scope.pkg = pkgs[packageName]; $scope.reverseDependencies = packageService.dependenciesOn(packageName); + var downloadCounts = _.pluck(pkgs, 'downloads'); + $scope.downloadsPercentile = _.filter(downloadCounts, function(d) { return d < $scope.pkg.downloads; }).length * 100.0 / downloadCounts.length; }); $scope.readme = $http.get("/packages/" + packageName + "-readme.txt").then(function(r) { return r.data; }); $scope.havePackage = function(pkgName) { diff --git a/html/partials/package.html b/html/partials/package.html index 028c0b8a..378b9153 100644 --- a/html/partials/package.html +++ b/html/partials/package.html @@ -12,7 +12,7 @@
Downloads
-
{{pkg.downloads}} (all versions)
+
{{pkg.downloads}} (all versions), percentile: {{downloadsPercentile | number:2}}
Source
{{pkg.source}}