Permalink
Browse files

tweaking the order functionality

  • Loading branch information...
1 parent 2d87bf6 commit e870c238c32cf6a44803b81dc97a2c12d6105956 erik committed Jul 18, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/news_item.rb
View
2 app/models/news_item.rb
@@ -147,7 +147,7 @@ class NewsItem < ActiveRecord::Base
}
named_scope :order_results, lambda { |type|
- return {} if type=='almost_funded'
+ return { :select => "news_items.*, case when news_items.status = 'active' then (1.0 - (news_items.current_funding / news_items.requested_amount)) else news_items.created_at end as sort_value" } if type=='almost-funded'
return { :order=>"news_items.created_at desc" }
}

0 comments on commit e870c23

Please sign in to comment.