myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2404] trunk/app/controllers/networks_controller.


From: noreply
Subject: [myexperiment-hackers] [2404] trunk/app/controllers/networks_controller.rb: added user rating and rank to group shared items sort
Date: Wed, 12 May 2010 12:06:25 -0400 (EDT)

Revision
2404
Author
dgc
Date
2010-05-12 12:06:25 -0400 (Wed, 12 May 2010)

Log Message

added user rating and rank to group shared items sort

Modified Paths

Diff

Modified: trunk/app/controllers/networks_controller.rb (2403 => 2404)


--- trunk/app/controllers/networks_controller.rb	2010-05-12 16:01:10 UTC (rev 2403)
+++ trunk/app/controllers/networks_controller.rb	2010-05-12 16:06:25 UTC (rev 2404)
@@ -239,11 +239,12 @@
   def show
 
     @item_sort_options = [
+      ["rank",          "Rank"],
       ["most_recent",   "Most recent"],
       ["title",         "Title"],
       ["uploader",      "Uploader"],
       ["last_updated",  "Last updated"],
-      ["rating",        "Rating"],
+      ["rating",        "User rating"],
       ["license",       "License"],
       ["workflow_type", "Workflow Type"]
     ]
@@ -252,6 +253,10 @@
 
     case params[:item_sort]
 
+      when "rank"; @shared_items.sort! do |a, b|
+        a.rank <=> b.rank
+      end
+
       when "title"; @shared_items.sort! do |a, b|
         a.contributable.label <=> b.contributable.label
       end
@@ -269,7 +274,7 @@
       end
 
       when "rating"; @shared_items.sort! do |a, b|
-        b.contributable.rating <=> a.contributable.rating
+        b.rating <=> a.rating
       end
 
       when "license"; @shared_items.sort! do |a, b|

reply via email to

[Prev in Thread] Current Thread [Next in Thread]