From d258208c496c15d306130531689efe22015c9545 Mon Sep 17 00:00:00 2001 From: i Date: Thu, 20 Jun 2013 23:18:57 -0300 Subject: [PATCH] improve the ordering of packages Packages are currently being sorted wrong. Packages with few users are showing up at the top because the average rating by a small number of users gets first priority. It would make more sense to sort by the _total_ number of stars rather than the average number, because this will reflect both number of users and how much they like the package in question. More complex sorting schemes (e.g., penalising extra for any instances of one-star) might also make sense. --- app/models/package.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/package.rb b/app/models/package.rb index 02da067..9cded78 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -63,7 +63,7 @@ def type(type) :conditions => "#{self.table_name}.created_at IS NOT NULL", :limit => 50 - named_scope :most_popular, :order => "score DESC, package_users_count DESC", + named_scope :most_popular, :order => "score DESC * package_users_count DESC", :include => :latest_version, :limit => 5