Modified: trunk/Rakefile (2413 => 2414)
--- trunk/Rakefile 2010-05-25 10:27:43 UTC (rev 2413)
+++ trunk/Rakefile 2010-05-26 13:52:43 UTC (rev 2414)
@@ -22,9 +22,17 @@
desc 'Refresh contribution caches'
task "myexp:refresh:contributions" do
require File.dirname(__FILE__) + '/config/environment'
+
Contribution.find(:all).each do |c|
c.contributable.update_contribution_rank
c.contributable.update_contribution_rating
+
+ ActiveRecord::Base.record_timestamps = false
+
+ c.update_attribute(:created_at, c.contributable.created_at)
+ c.update_attribute(:updated_at, c.contributable.updated_at)
+
+ ActiveRecord::Base.record_timestamps = true
end
end
Modified: trunk/app/controllers/networks_controller.rb (2413 => 2414)
--- trunk/app/controllers/networks_controller.rb 2010-05-25 10:27:43 UTC (rev 2413)
+++ trunk/app/controllers/networks_controller.rb 2010-05-26 13:52:43 UTC (rev 2414)
@@ -254,7 +254,7 @@
case params[:item_sort]
when "rank"; @shared_items.sort! do |a, b|
- a.rank <=> b.rank
+ b.rank <=> a.rank
end
when "title"; @shared_items.sort! do |a, b|
@@ -262,19 +262,19 @@
end
when "most_recent"; @shared_items.sort! do |a, b|
- a.contributable.created_at <=> b.contributable.created_at
+ b.contributable.created_at <=> a.contributable.created_at
end
when "uploader"; @shared_items.sort! do |a, b|
if a.contributor.label == b.contributor.label
- a.rank <=> b.rank
+ b.rank <=> a.rank
else
a.contributor.label <=> b.contributor.label
end
end
when "last_updated"; @shared_items.sort! do |a, b|
- a.contributable.updated_at <=> b.contributable.updated_at
+ b.contributable.updated_at <=> a.contributable.updated_at
end
when "rating"; @shared_items.sort! do |a, b|
@@ -283,7 +283,7 @@
b_rating = b.rating
if a_rating == b_rating
- a.rank <=> b.rank
+ b.rank <=> a.rank
else
b.rating <=> a.rating
end
@@ -296,7 +296,7 @@
if (a_has_licence && b_has_licence)
if a.contributable.license == b.contributable.license
- a.rank <=> b.rank
+ b.rank <=> a.rank
else
a.contributable.license.title <=> b.contributable.license.title
end
@@ -305,7 +305,7 @@
elsif (!a_has_licence && b_has_licence)
1
else
- a.rank <=> b.rank
+ b.rank <=> a.rank
end
end
@@ -316,7 +316,7 @@
if (a_has_content_type && b_has_content_type)
if a.contributable.content_type == b.contributable.content_type
- a.rank <=> b.rank
+ b.rank <=> a.rank
else
a.contributable.content_type.title <=> b.contributable.content_type.title
end
@@ -325,7 +325,7 @@
elsif (!a_has_content_type && b_has_content_type)
1
else
- a.rank <=> b.rank
+ b.rank <=> a.rank
end
end
end