forked from OpenNeo/impress
Filter trade lists to active users only
I don't have the cute fancy UI with trade list names included, but! Now the trade ratios should match DTI 2020 and that's nice!
This commit is contained in:
parent
16328d3840
commit
bec350e9f2
2 changed files with 5 additions and 1 deletions
|
@ -72,7 +72,7 @@ class ItemsController < ApplicationController
|
|||
includes_child_translations.group_by(&:species)
|
||||
|
||||
trading_closet_hangers = @item.closet_hangers.trading.newest.
|
||||
includes(:user)
|
||||
user_is_active.includes(:user)
|
||||
|
||||
@trading_closet_hangers_by_owned = {
|
||||
true => trading_closet_hangers.filter { |c| c.owned? },
|
||||
|
|
|
@ -46,6 +46,10 @@ class ClosetHanger < ApplicationRecord
|
|||
scope :newest, -> { order(arel_table[:created_at].desc) }
|
||||
scope :owned_before_wanted, -> { order(arel_table[:owned].desc) }
|
||||
scope :unlisted, -> { where(:list_id => nil) }
|
||||
scope :user_is_active, -> {
|
||||
u = User.arel_table
|
||||
joins(:user).where(u[:last_trade_activity_at].gteq(6.months.ago))
|
||||
}
|
||||
|
||||
before_validation :merge_quantities, :set_owned_by_list
|
||||
|
||||
|
|
Loading…
Reference in a new issue