Commit feac21d8 by ivan Lan

Fix status_zh and some spell mistake

parent abc08581
...@@ -41,7 +41,7 @@ module Shotengai ...@@ -41,7 +41,7 @@ module Shotengai
'products' => options[:product], 'products' => options[:product],
'orders' => options[:order], 'orders' => options[:order],
'product_series' => "#{options[:product]}Series", 'product_series' => "#{options[:product]}Series",
'product_snapshots' => "#{options[:product]}Snapshots", 'product_snapshots' => "#{options[:product]}Snapshot",
}.each do |key, klass_name| }.each do |key, klass_name|
@key, @klass_name, @role = key, klass_name, role @key, @klass_name, @role = key, klass_name, role
......
json.partial! "shotengai/share/snaoshot", snaoshot: @resource json.partial! "shotengai/share/snapshot", snapshot: @resource
...@@ -27,7 +27,7 @@ module Shotengai ...@@ -27,7 +27,7 @@ module Shotengai
# Using validates_uniqueness_of do not work if the order of Hash is diff # Using validates_uniqueness_of do not work if the order of Hash is diff
validate :uniq_spec validate :uniq_spec
delegate :title, :detail, :banners, :cover_image, to: :product delegate :title, :detail, :banners, :cover_image, :status, to: :product
scope :query_spec_with_product, ->(val, product) { scope :query_spec_with_product, ->(val, product) {
return none unless val.keys.sort == product.spec.keys.sort return none unless val.keys.sort == product.spec.keys.sort
......
...@@ -31,9 +31,6 @@ module Shotengai ...@@ -31,9 +31,6 @@ module Shotengai
validate :check_spec, if: :spec validate :check_spec, if: :spec
validates :count, numericality: { only_integer: true, greater_than: 0 } validates :count, numericality: { only_integer: true, greater_than: 0 }
delegate :product_status_zh, to: :product
delegate :order_status_zh, to: :order
class << self class << self
def inherited subclass def inherited subclass
product_name = /^(.+)Snapshot/.match(subclass.name)[1] product_name = /^(.+)Snapshot/.match(subclass.name)[1]
...@@ -70,12 +67,21 @@ module Shotengai ...@@ -70,12 +67,21 @@ module Shotengai
###### view ###### view
def total_price def total_price
count * price revised_amount || count * price
end end
def total_original_price def total_original_price
count * original_price count * original_price
end end
def product_status_zh
series.status_zh
end
def order_status_zh
order&.status_zh
end
###### ######
private private
......
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