1
0
Fork 0
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:
Emi Matchu 2024-01-19 00:38:16 -08:00
parent 16328d3840
commit bec350e9f2
2 changed files with 5 additions and 1 deletions

View file

@ -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? },

View file

@ -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