Skip to content

Commit

Permalink
Use pluck where posible
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Oct 24, 2024
1 parent 40633be commit 2e997f8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/saved_annotations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def new
authorize SavedAnnotation
@annotations = AnnotationPolicy::Scope.new(current_user, Annotation.all).resolve
@annotations = @annotations.where(saved_annotation_id: nil).where(user_id: current_user.id)
submissions = Submission.where(id: @annotations.map(&:submission_id).uniq)
@courses = Course.where(id: submissions.map(&:course_id).uniq)
@exercises = Activity.where(id: submissions.map(&:exercise_id).uniq)
submissions = Submission.where(id: @annotations.pluck(:submission_id).uniq)
@courses = Course.where(id: submissions.pluck(:course_id).uniq)
@exercises = Activity.where(id: submissions.pluck(:exercise_id).uniq)
@annotations = apply_scopes(@annotations.order_by_created_at(:DESC))
.includes(:course).includes(:user).includes(:submission)
.paginate(page: parse_pagination_param(params[:page]), per_page: parse_pagination_param(params[:per_page]))
Expand Down

0 comments on commit 2e997f8

Please sign in to comment.