Commit e002fccf by ivan Lan

Fix status_zh

parent feac21d8
......@@ -56,7 +56,7 @@ module Shotengai
delivering: '运送中',
received: '已收货',
evaluated: '已评价',
}[ status ]
}[ status.to_sym ]
end
def fill_snapshot
......
......@@ -40,10 +40,10 @@ module Shotengai
def status_zh
{
on_on: '未上架',
no_on: '未上架',
on_sale: '已上架',
deleted: '已删除'
}[ status ]
}[ status.to_sym ]
end
def default_series
......
......@@ -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, :status, to: :product
delegate :title, :detail, :banners, :cover_image, :status_zh, to: :product
scope :query_spec_with_product, ->(val, product) {
return none unless val.keys.sort == product.spec.keys.sort
......
......@@ -31,6 +31,8 @@ module Shotengai
validate :check_spec, if: :spec
validates :count, numericality: { only_integer: true, greater_than: 0 }
belongs_to :shotengai_order, optional: true
class << self
def inherited subclass
product_name = /^(.+)Snapshot/.match(subclass.name)[1]
......@@ -79,7 +81,7 @@ module Shotengai
end
def order_status_zh
order&.status_zh
shotengai_order&.status_zh
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