From cf34724506ac77085a9aff0df651be63eeacd8ec Mon Sep 17 00:00:00 2001 From: Doug Johnston Date: Wed, 27 Jan 2016 10:29:07 -0800 Subject: [PATCH 1/2] Fix issue displaying completed orders in admin Fixes an issue where checking the 'only show complete orders' checkbox and then unchecking it was no longer displaying completed orders. A similar fix was merged into Spree after the Solidus fork: https://github.com/spree/spree/commit/69a20c3abfeef155754b4afaa3c179759b5dd60a --- .../spree/admin/orders_controller.rb | 1 + .../features/admin/orders/listing_spec.rb | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/backend/app/controllers/spree/admin/orders_controller.rb b/backend/app/controllers/spree/admin/orders_controller.rb index 14782811f3b..f3858e8a20e 100644 --- a/backend/app/controllers/spree/admin/orders_controller.rb +++ b/backend/app/controllers/spree/admin/orders_controller.rb @@ -15,6 +15,7 @@ def index params[:q][:completed_at_not_null] ||= '1' if Spree::Config[:show_only_complete_orders_by_default] @show_only_completed = params[:q][:completed_at_not_null] == '1' params[:q][:s] ||= @show_only_completed ? 'completed_at desc' : 'created_at desc' + params[:q][:completed_at_not_null] = '' unless @show_only_completed # As date params are deleted if @show_only_completed, store # the original date so we can restore them into the params diff --git a/backend/spec/features/admin/orders/listing_spec.rb b/backend/spec/features/admin/orders/listing_spec.rb index 26bfc40e0ac..ef679b56698 100644 --- a/backend/spec/features/admin/orders/listing_spec.rb +++ b/backend/spec/features/admin/orders/listing_spec.rb @@ -126,5 +126,25 @@ within("table#listing_orders") { expect(page).not_to have_content("R200") } end end + + context 'filter on complete orders' do + before do + create(:order, number: 'R300', completed_at: nil, state: 'cart') + end + + it "should show both complete and incomplete orders" do + check "q_completed_at_not_null" + click_on 'Filter' + + expect(page).to have_content("R200") + expect(page).to_not have_content("R300") + + uncheck "q_completed_at_not_null" + click_on 'Filter Results' + + expect(page).to have_content("R200") + expect(page).to have_content("R300") + end + end end end From 06a31d870d4e6329bb3fc455b4444ddcbc0c923e Mon Sep 17 00:00:00 2001 From: Doug Johnston Date: Thu, 28 Jan 2016 13:18:58 -0800 Subject: [PATCH 2/2] Fix inaccurate test name; add changlog --- CHANGELOG.md | 9 ++++++--- backend/spec/features/admin/orders/listing_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a2a8f0177e..dd402935494 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ ## Solidus 1.3.0 (unreleased) -* Removed Spree::BaseHelper#gem_available? and Spree::BaseHelper#current_spree_page? +* Removed Spree::BaseHelper#gem_available? and Spree::BaseHelper#current_spree_page? - Both these methods were untested and not appropriate code to be in core. If you need these - methods please pull them into your app. [#710](https://github.com/solidusio/solidus/pull/710). + Both these methods were untested and not appropriate code to be in core. If you need these + methods please pull them into your app. [#710](https://github.com/solidusio/solidus/pull/710). + +* Fixed a bug where toggling 'show only complete order' on/off was not showing + all orders. [#749](https://github.com/solidusio/solidus/pull/749) ## Solidus 1.2.0 (unreleased) diff --git a/backend/spec/features/admin/orders/listing_spec.rb b/backend/spec/features/admin/orders/listing_spec.rb index ef679b56698..7552d19e4c2 100644 --- a/backend/spec/features/admin/orders/listing_spec.rb +++ b/backend/spec/features/admin/orders/listing_spec.rb @@ -127,12 +127,12 @@ end end - context 'filter on complete orders' do + context "when toggling the completed orders checkbox" do before do create(:order, number: 'R300', completed_at: nil, state: 'cart') end - it "should show both complete and incomplete orders" do + it "shows both complete and incomplete orders" do check "q_completed_at_not_null" click_on 'Filter'