Skip to content

Commit c061d92

Browse files
committed
Refine data center controller: ensure actions only apply to active users by filtering team.users appropriately.
1 parent c480d2c commit c061d92

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/controllers/data_center_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,11 @@ def daily_report
512512
tickets.where.not(statuses: { name: outstanding_statuses })
513513
end.order('add_statuses.updated_at DESC')
514514

515-
hod_emails = team.users.select { |u| u.has_role?(:hod) }.map(&:email)
515+
hod_emails = team.users.where(active: true).select { |u| u.has_role?(:hod) }.map(&:email)
516516
mail_options = {}
517517
mail_options[:cc] = hod_emails if hod_emails.any?
518518

519-
team.users.each do |user|
519+
team.users.where(active: true).each do |user|
520520
tagged_tickets = tickets.select('tickets.*, add_statuses.updated_at')
521521
.joins(:taggings)
522522
.where(taggings: { user_id: user.id })
@@ -549,7 +549,7 @@ def send_team_ticket_emails
549549
.where(users: { id: user_ids })
550550
.where.not(statuses: { name: outstanding_statuses })
551551

552-
team.users.each do |user|
552+
team.users.where(active: true).each do |user|
553553
user_tickets = base_scope.where(taggings: { user_id: user.id }).distinct
554554
UserMailer.morning_ticket_email(user, user_tickets.to_a).deliver_later if user_tickets.any?
555555
end

0 commit comments

Comments
 (0)