Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moving order statement

  • Loading branch information...
commit eac89bd1bf7bde4f71d5cad6823f80dc02858302 1 parent c1486bd
erik authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 app/models/news_item.rb
View
4 app/models/news_item.rb
@@ -115,7 +115,7 @@ class NewsItem < ActiveRecord::Base
named_scope :featured, :conditions => {:feature => true}, :order => "news_items.created_at desc"
named_scope :unfunded, :conditions => "news_items.status NOT IN('accepted','funded','closed')"
named_scope :funded, :conditions => "news_items.status IN ('accepted','funded')"
- named_scope :almost_funded, :select => "news_items.*, if(news_items.status='active', 1.0 - (news_items.current_funding / news_items.requested_amount), news_items.created_at) as sort_value", :order => "sort_value ASC"
+ named_scope :almost_funded, :select => "news_items.*, if(news_items.status='active', 1.0 - (news_items.current_funding / news_items.requested_amount), news_items.created_at) as sort_value"
named_scope :published, :conditions => {:status => 'published'}
named_scope :suggested, :conditions => "news_items.type='Tip' AND news_items.status NOT IN ('unapproved','draft','closed')"
named_scope :browsable, :include => :user, :conditions => "news_items.status != 'unapproved' and news_items.status != 'closed'"
@@ -211,7 +211,7 @@ def self.get_stories(page, topic_id, grouping_id, topic, selected_filter, curren
having_cache ["news_items_stories_", page, topic_id, grouping_id, topic, selected_filter, current_network, limit, @@per_page], {:expires_in => CACHE_TIMEOUT } do
unless limit
if selected_filter=='almost-funded'
- self.constrain_topic_id(topic_id).constrain_grouping_id(grouping_id).constrain_type(selected_filter).constrain_topic(topic).send(selected_filter.gsub('-','_')).order_results(selected_filter).browsable.by_network(current_network).paginate(:page => page, :select => "news_items.*, if(news_items.status='active', 1.0 - (news_items.current_funding / news_items.requested_amount), news_items.created_at) as sort_value" )
+ self.constrain_topic_id(topic_id).constrain_grouping_id(grouping_id).constrain_type(selected_filter).constrain_topic(topic).send(selected_filter.gsub('-','_')).order_results(selected_filter).browsable.by_network(current_network).paginate(:page => page, :select => "news_items.*, if(news_items.status='active', 1.0 - (news_items.current_funding / news_items.requested_amount), news_items.created_at) as sort_value", :order => "sort_value ASC" )
else
self.constrain_topic_id(topic_id).constrain_grouping_id(grouping_id).constrain_type(selected_filter).constrain_topic(topic).send(selected_filter.gsub('-','_')).order_results(selected_filter).browsable.by_network(current_network).paginate(:page => page)
end
Please sign in to comment.
Something went wrong with that request. Please try again.