From 8b0296eae64e4bd2751df68335a76e23c97ee5c9 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Wed, 26 Jun 2019 11:38:03 +0100 Subject: [PATCH] Use a single query to get filter_schedules_by_enterprise_id --- app/controllers/admin/schedules_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/schedules_controller.rb b/app/controllers/admin/schedules_controller.rb index 17a7b90a0c..9c84d07fac 100644 --- a/app/controllers/admin/schedules_controller.rb +++ b/app/controllers/admin/schedules_controller.rb @@ -40,7 +40,7 @@ module Admin # Filter schedules by OCs with a given coordinator id def filter_schedules_by_enterprise_id(schedules, enterprise_id) - schedules.select { |schedule| schedule.coordinators.map(&:id).include? enterprise_id.to_i } + schedules.where("order_cycles.coordinator_id = ?", enterprise_id.to_i) end def collection_actions