mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Use estimated subscription total for proxy orders if order has not been initialized
This commit is contained in:
committed by
Maikel Linke
parent
fb93351386
commit
cead905d05
@@ -5,11 +5,8 @@ module Api
|
||||
attributes :update_issues
|
||||
|
||||
def total
|
||||
if object.total.present?
|
||||
object.total.to_money.to_s
|
||||
else
|
||||
object.subscription.subscription_line_items.sum(&:total_estimate)
|
||||
end
|
||||
return unless object.total.present?
|
||||
object.total.to_money.to_s
|
||||
end
|
||||
|
||||
def update_issues
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
%div{ ng: { bind: "::orderCycleCloses(proxyOrder.order_cycle_id)" } }
|
||||
%td.text-center
|
||||
%span.state{ ng: { class: "proxyOrder.state", bind: 'stateText(proxyOrder.state)' } }
|
||||
%td.text-center{ ng: { bind: 'proxyOrder.total | currency' } }
|
||||
%td.text-center{ ng: { bind: '(proxyOrder.total || subscription.estimatedTotal()) | currency' } }
|
||||
%td.actions
|
||||
%a.edit-order.icon-edit.no-text{ href: '{{::proxyOrder.edit_path}}', target: '_blank', 'ofn-with-tip' => t(:edit_order), confirm_order_edit: true }
|
||||
%a.cancel-order.icon-remove.no-text{ href: 'javascript:void(0)', ng: { hide: "proxyOrder.state == 'canceled'", click: "cancelOrder(proxyOrder)" }, 'ofn-with-tip' => t(:cancel_order) }
|
||||
|
||||
@@ -87,6 +87,7 @@ feature 'Subscriptions' do
|
||||
|
||||
within ".subscription-orders" do
|
||||
expect(page).to have_selector "tr.proxy_order", count: 1
|
||||
expect(page).to have_content "$18.50" # 3 x $5 items + $3.5 shipping
|
||||
|
||||
proxy_order = subscription.proxy_orders.first
|
||||
within "tr#po_#{proxy_order.id}" do
|
||||
|
||||
Reference in New Issue
Block a user