diff options
| author | cedricnjanga | 2018-04-26 11:31:05 -0700 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-05-28 12:48:49 +0200 |
| commit | 9f988815907182dd9194d546b19ac4911c804d0e (patch) | |
| tree | 5f6838981ce7b4ce55251f688e82230e018f0e20 /app/controllers/stop_areas_controller.rb | |
| parent | cd3c110893a7b1845e5ff420f7f28d30b0b78825 (diff) | |
| download | chouette-core-9f988815907182dd9194d546b19ac4911c804d0e.tar.bz2 | |
Refs #6433 Use ransackable scope for stop area status filter
Diffstat (limited to 'app/controllers/stop_areas_controller.rb')
| -rw-r--r-- | app/controllers/stop_areas_controller.rb | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index c3d27cc6c..38363e8ef 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -120,7 +120,6 @@ class StopAreasController < ChouetteController def collection scope = parent.present? ? parent.stop_areas : referential.stop_areas - scope = ransack_status(scope) if params[:q] && params[:q][:status_eq_any] @q = scope.search(params[:q]) if sort_column && sort_direction @@ -206,29 +205,4 @@ class StopAreasController < ChouetteController ] + permitted_custom_fields_params(Chouette::StopArea.custom_fields(stop_area_referential.workgroup)) params.require(:stop_area).permit(fields) end - - # Fake ransack filter - def ransack_status scope - status_param = params[:q][:status_eq_any].reject(&:blank?) - params[:q].delete :status_eq_any - - return scope unless status_param - return scope if status_param.empty? || status_param.length == 3 - - - @status = Hash.new do |hash| - hash[:status_eq_any] = { - in_creation: status_param.include?('in_creation'), - confirmed: status_param.include?('confirmed'), - deactivated: status_param.include?('deactivated'), - } - end - - scope = Chouette::StopArea.where( - "confirmed_at #{(@status[:status_eq_any][:confirmed] || @status[:status_eq_any][:deactivated]) ? "IS NOT NULL" : "IS NULL"} - AND deleted_at #{@status[:status_eq_any][:deactivated] ? "IS NOT NULL" : "IS NULL"}" - ) - - scope - end end |
