changed about you, changed price settings

This commit is contained in:
Senad Uka
2015-10-01 15:48:32 +02:00
parent 4470e85344
commit c75b112027
4 changed files with 34 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ class Item < ActiveRecord::Base
end
# TODO: change "best selling" algorithm when get some data - currently it's only sorted by earnings
scope :best_selling, -> (offset, limit) { where(:on_display => true).order("(list_price - current_input_price) DESC").limit(limit).offset(offset) }
scope :best_selling, -> (offset, limit) { where(:on_display => true).order("list_price ASC").limit(limit).offset(offset) }
scope :best_selling_in_sub_category, -> (sub_category_id, offset, limit) { best_selling(offset, limit).where(sub_category_id: sub_category_id) }