Sha256: 33cfbbc1e703463c98e3a6143fed5505327cd5cd70ff1df7976365d8b806badb
Contents?: true
Size: 376 Bytes
Versions: 2
Compression:
Stored size: 376 Bytes
Contents
module Workarea module Admin decorate PricingSkuViewModel, with: :margin do def show_cost return if cost == 0 cost end def margin return if cost == 0 on_sale ? find_margin(sale_price) : find_margin(regular_price) end def find_margin(price) ((price - cost) / price) * 100 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-margin-1.0.1 | app/view_models/workarea/admin/pricing_sku_view_model.decorator |
workarea-margin-1.0.0.pre | app/view_models/workarea/admin/pricing_sku_view_model.decorator |