feat: better queries for gathering the volunteers

parent 34a8bc2c
Pipeline #47793 passed with stage
in 36 minutes and 58 seconds
......@@ -32,7 +32,8 @@ class SemesterProcessesController < ApplicationController
def overdue
@semester_process.kind = :reminder
@volunteers = @semester_process.semester_process_volunteers.where(commited_at: nil).map(&:volunteer)
@volunteers = Volunteer.joins(:semester_process_volunteers)
.merge(@semester_process.semester_process_volunteers.unsubmitted)
@semester_process.build_semester_volunteers(@volunteers, preselect: true)
@spvs_sorted = sort_volunteers
......@@ -90,7 +91,10 @@ class SemesterProcessesController < ApplicationController
reminder_mail_body_template: semester_process_params[:body],
reminder_mail_subject_template: semester_process_params[:subject]
)
@volunteers = @semester_process.semester_process_volunteers.where(volunteer_id: selected_volunteers).map(&:volunteer)
@volunteers = Volunteer.joins(:semester_process_volunteers)
.merge(@semester_process.semester_process_volunteers.unsubmitted)
.find(selected_volunteers)
@semester_process.build_volunteers_feedbacks_and_mails(@volunteers.map(&:id))
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment