File tree Expand file tree Collapse file tree
components/solidus_admin/orders/index
controllers/solidus_admin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ def items_column
162162 {
163163 header : :items ,
164164 data : -> ( order ) do
165- content_tag :div , t ( ".columns.items" , count : order . line_items . sum ( :quantity ) )
165+ content_tag :div , t ( ".columns.items" , count : order . line_items . sum ( & :quantity ) )
166166 end
167167 }
168168 end
Original file line number Diff line number Diff line change @@ -19,15 +19,15 @@ def search_scopes
1919
2020 private
2121
22- def apply_search_to ( relation , param :)
22+ def apply_search_to ( relation , param :, distinct : true )
2323 relation = apply_scopes_to ( relation , param :)
24- apply_ransack_search_to ( relation , param :)
24+ apply_ransack_search_to ( relation , param :, distinct : )
2525 end
2626
27- def apply_ransack_search_to ( relation , param :)
27+ def apply_ransack_search_to ( relation , param :, distinct : true )
2828 relation
2929 . ransack ( params [ param ] &.except ( :scope ) )
30- . result ( distinct : true )
30+ . result ( distinct :)
3131 end
3232
3333 def apply_scopes_to ( relation , param :)
Original file line number Diff line number Diff line change @@ -5,16 +5,17 @@ class OrdersController < SolidusAdmin::BaseController
55 include Spree ::Core ::ControllerHelpers ::StrongParameters
66 include SolidusAdmin ::ControllerHelpers ::Search
77
8- search_scope ( :completed , default : true ) { _1 . complete }
9- search_scope ( :canceled ) { _1 . canceled }
10- search_scope ( :returned ) { _1 . with_state ( :returned ) }
11- search_scope ( :in_progress ) { _1 . with_state ( [ :cart ] + _1 . checkout_step_names ) }
12- search_scope ( :all ) { _1 }
8+ search_scope ( :completed , default : true ) { _1 . complete . order ( completed_at : :desc ) }
9+ search_scope ( :canceled ) { _1 . canceled . order ( completed_at : :desc ) }
10+ search_scope ( :returned ) { _1 . with_state ( :returned ) . order ( completed_at : :desc ) }
11+ search_scope ( :in_progress ) { _1 . with_state ( [ :cart ] + _1 . checkout_step_names ) . order ( id : :desc ) }
12+ search_scope ( :all ) { _1 . order ( id : :desc ) }
1313
1414 def index
1515 orders = apply_search_to (
16- Spree ::Order . order ( created_at : :desc , id : :desc ) ,
17- param : :q
16+ Spree ::Order . includes ( :line_items ) ,
17+ param : :q ,
18+ distinct : false
1819 )
1920
2021 set_page_and_extract_portion_from ( orders )
You can’t perform that action at this time.
0 commit comments