Commit feac21d8 by ivan Lan

Fix status_zh and some spell mistake

parent abc08581
......@@ -82,4 +82,4 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1]
add_index :shotengai_snapshots, :type
end
end
\ No newline at end of file
end
......@@ -41,7 +41,7 @@ module Shotengai
'products' => options[:product],
'orders' => options[:order],
'product_series' => "#{options[:product]}Series",
'product_snapshots' => "#{options[:product]}Snapshots",
'product_snapshots' => "#{options[:product]}Snapshot",
}.each do |key, klass_name|
@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
# Using validates_uniqueness_of do not work if the order of Hash is diff
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) {
return none unless val.keys.sort == product.spec.keys.sort
......
......@@ -31,9 +31,6 @@ module Shotengai
validate :check_spec, if: :spec
validates :count, numericality: { only_integer: true, greater_than: 0 }
delegate :product_status_zh, to: :product
delegate :order_status_zh, to: :order
class << self
def inherited subclass
product_name = /^(.+)Snapshot/.match(subclass.name)[1]
......@@ -70,12 +67,21 @@ module Shotengai
###### view
def total_price
count * price
revised_amount || count * price
end
def total_original_price
count * original_price
end
def product_status_zh
series.status_zh
end
def order_status_zh
order&.status_zh
end
######
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