Use a single query to get filter_schedules_by_enterprise_id

This commit is contained in:
luisramos0
2019-06-26 11:38:03 +01:00
parent f23094df09
commit 8b0296eae6

View File

@@ -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