Commit f35451b2 by ivan Lan

A

parent 1bf6c345
......@@ -74,10 +74,6 @@ module Shotengai
Shotengai::Series.alive.find_by_id(default_series_id) || series.alive.first
end
def series_with_spec_value val, eql=true
series_class.query_spec_value_with_product(val, self, eql)
end
def meta
super || {}
end
......@@ -150,6 +146,10 @@ module Shotengai
}
end
end
def series_with_spec_value val, eql: true
series_class.query_spec_value_with_product(val, self, eql: eql)
end
end
end
end
......@@ -54,7 +54,7 @@ module Shotengai
scope :recycle_bin, ->{ unscope(where: :aasm_state).deleted.where('updated_at < ?', Time.now - 10.day )}
# where("spec->'$.\"颜色\"' = ? and spec->'$.\"大小\"' = ?" ,红色,S)
scope :query_spec_value_with_product, ->(val, product, eql=true) {
scope :query_spec_value_with_product, ->(val, product, eql: true) {
if val.keys.sort == product.spec_template.keys.sort || (eql.! && (val.keys - product.spec_template.keys).empty?)
keys = []; values = [];
proc = Proc.new { |k, v| keys << "spec_value->'$.\"#{k}\"' = ? "; values << v }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment