Skip to content

Commit

Permalink
Use pluck instead of select for better performance
Browse files Browse the repository at this point in the history
Also use .uniq just to be sure.
  • Loading branch information
Splines committed Oct 8, 2024
1 parent 6d0be7e commit 8f9ef78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/lecture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,8 @@ def update_speaker_status!(user, selected_talks)
end

def voucher_redeemers(voucher_scope)
User.where(id: Redemption.where(voucher: voucher_scope).select(:user_id))
user_ids = Redemption.where(voucher: voucher_scope).pluck(:user_id)
User.where(id: user_ids.uniq)
end

def tutors_by_redemption
Expand Down

0 comments on commit 8f9ef78

Please sign in to comment.