Commit 5f69f665 by ivan Lan

Improve snapshot :check_remark_value

parent b0b02b81
......@@ -165,9 +165,8 @@ module Shotengai
end
def check_remark_value
nullable_keys = (series.remark_value.decode || {}).select{ |k, v| v }&.keys
required_keys = product.remark_template.keys - nullable_keys
absent_keys = required_keys - remark_value.keys
required_keys = (series.remark_value.decode || {}).select{ |k, v| v }&.keys
absent_keys = required_keys - (remark_value || {}).keys
# remark 可添加多余字段
errors.add(:remark_value, "必填remark值为空, #{absent_keys}") unless absent_keys.empty?
end
......
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