Skip to content
This repository
Browse code

tweaking the order functionality

  • Loading branch information...
commit e870c238c32cf6a44803b81dc97a2c12d6105956 1 parent 2d87bf6
authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  app/models/news_item.rb
2  app/models/news_item.rb
@@ -147,7 +147,7 @@ class NewsItem < ActiveRecord::Base
147 147
   }
148 148
   
149 149
   named_scope :order_results, lambda { |type|
150  
-    return {} if type=='almost_funded'
  150
+    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'
151 151
     return { :order=>"news_items.created_at desc" }
152 152
   }
153 153
   

0 notes on commit e870c23

Please sign in to comment.
Something went wrong with that request. Please try again.