Commit b47cc3509d722f2a1c7da3d31f7abbaf7df04cbc
1 parent
71129f10
Exists in
theme-brasil-digital-from-staging
and in
4 other branches
Fix processed tasks action in task controller
Showing
3 changed files
with
3 additions
and
3 deletions
Show diff stats
app/controllers/my_profile/tasks_controller.rb
... | ... | @@ -178,7 +178,7 @@ class TasksController < MyProfileController |
178 | 178 | end |
179 | 179 | |
180 | 180 | def filter_tasks(filter, tasks) |
181 | - tasks = tasks.includes(:requestor, :closed_by) | |
181 | + tasks = tasks.eager_load(:requestor, :closed_by) | |
182 | 182 | tasks = tasks.of(filter[:type].presence) |
183 | 183 | tasks = tasks.where(:status => filter[:status]) unless filter[:status].blank? |
184 | 184 | tasks = filter_by_creation_date(filter, tasks) | ... | ... |
app/models/task.rb
... | ... | @@ -316,7 +316,7 @@ class Task < ActiveRecord::Base |
316 | 316 | scope :canceled, -> { where status: Task::Status::CANCELLED } |
317 | 317 | scope :closed, -> { where status: [Task::Status::CANCELLED, Task::Status::FINISHED] } |
318 | 318 | scope :opened, -> { where status: [Task::Status::ACTIVE, Task::Status::HIDDEN] } |
319 | - scope :of, -> type { where "type LIKE ?", type if type } | |
319 | + scope :of, -> type { where "tasks.type LIKE ?", type if type } | |
320 | 320 | scope :order_by, -> attribute, ord { order "#{attribute} #{ord}" } |
321 | 321 | scope :like, -> field, value { where "LOWER(#{field}) LIKE ?", "%#{value.downcase}%" if value } |
322 | 322 | scope :pending_all, -> profile, filter_type, filter_text { | ... | ... |
test/functional/tasks_controller_test.rb
... | ... | @@ -74,7 +74,7 @@ class TasksControllerTest < ActionController::TestCase |
74 | 74 | |
75 | 75 | assert_response :success |
76 | 76 | assert_template 'processed' |
77 | - assert_kind_of Array, assigns(:tasks) | |
77 | + assert_kind_of ActiveRecord::Relation, assigns(:tasks) | |
78 | 78 | end |
79 | 79 | |
80 | 80 | should 'display task created_at' do | ... | ... |