diff --git a/app/serializers/api/admin/proxy_order_serializer.rb b/app/serializers/api/admin/proxy_order_serializer.rb index f5f24522bd..e496c33957 100644 --- a/app/serializers/api/admin/proxy_order_serializer.rb +++ b/app/serializers/api/admin/proxy_order_serializer.rb @@ -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 diff --git a/app/views/admin/subscriptions/_orders_panel.html.haml b/app/views/admin/subscriptions/_orders_panel.html.haml index 7bbf1b20b0..7314ee244d 100644 --- a/app/views/admin/subscriptions/_orders_panel.html.haml +++ b/app/views/admin/subscriptions/_orders_panel.html.haml @@ -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) } diff --git a/spec/features/admin/subscriptions_spec.rb b/spec/features/admin/subscriptions_spec.rb index ccdac62aef..3ca4e0efe2 100644 --- a/spec/features/admin/subscriptions_spec.rb +++ b/spec/features/admin/subscriptions_spec.rb @@ -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