Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue displaying completed orders in admin #749

Merged
merged 2 commits into from
Jan 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
1 change: 1 addition & 0 deletions backend/app/controllers/spree/admin/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions backend/spec/features/admin/orders/listing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,25 @@
within("table#listing_orders") { expect(page).not_to have_content("R200") }
end
end

context "when toggling the completed orders checkbox" do
before do
create(:order, number: 'R300', completed_at: nil, state: 'cart')
end

it "shows 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