Show percentiles for download counts on individual package pages

This commit is contained in:
Steve Purcell 2013-09-24 19:01:44 +01:00
parent e2768ed591
commit 67514ea5cb
2 changed files with 3 additions and 1 deletions

View file

@ -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) {

View file

@ -12,7 +12,7 @@
<div class="well">
<dl class="dl-horizontal">
<dt>Downloads</dt>
<dd>{{pkg.downloads}} <span class="muted">(all versions)</span></dd>
<dd>{{pkg.downloads}} <span class="muted">(all versions)</span>, percentile: {{downloadsPercentile | number:2}}</dd>
<dt>Source</dt>
<dd>
<a ng-show="pkg.sourceURL" href="{{pkg.sourceURL}}">{{pkg.source}}</a>