Add is:pb back to item search

This commit is contained in:
Matchu 2023-07-26 11:51:52 -07:00 committed by Matchu
parent 66db73748a
commit a653b0c20d
2 changed files with 20 additions and 0 deletions

View file

@ -65,6 +65,16 @@ class Item < ActiveRecord::Base
condition = i[:rarity_index].in(Item::NCRarities).or(i[:is_manually_nc]) condition = i[:rarity_index].in(Item::NCRarities).or(i[:is_manually_nc])
where(condition.not) where(condition.not)
} }
scope :is_pb, -> {
Item.joins(:translations).where('locale = ?', 'en').
where('description LIKE ?',
'%' + Item.sanitize_sql_like(PAINTBRUSH_SET_DESCRIPTION) + '%')
}
scope :is_not_pb, -> {
Item.joins(:translations).where('locale = ?', 'en').
where('description NOT LIKE ?',
'%' + Item.sanitize_sql_like(PAINTBRUSH_SET_DESCRIPTION) + '%')
}
def closeted? def closeted?
@owned || @wanted @owned || @wanted

View file

@ -44,6 +44,8 @@ class Item
filters << (is_positive ? Filter.is_nc : Filter.is_not_nc) filters << (is_positive ? Filter.is_nc : Filter.is_not_nc)
when 'np' when 'np'
filters << (is_positive ? Filter.is_np : Filter.is_not_np) filters << (is_positive ? Filter.is_np : Filter.is_not_np)
when 'pb'
filters << (is_positive ? Filter.is_pb : Filter.is_not_pb)
else else
message = I18n.translate('items.search.errors.not_found.label', message = I18n.translate('items.search.errors.not_found.label',
:label => "is:#{value}") :label => "is:#{value}")
@ -114,6 +116,14 @@ class Item
def self.is_not_np def self.is_not_np
self.new Item.is_nc, '-is:np' self.new Item.is_nc, '-is:np'
end end
def self.is_pb
self.new Item.is_pb, 'is:pb'
end
def self.is_not_pb
self.new Item.is_not_pb, '-is:pb'
end
end end
end end
end end