fix: scope for Volunteer.feedback_overdue replaced with working scope with semester

- the feedback_overdue scope is either not working in this case, or not working at all
parent ccdfb4df
......@@ -24,7 +24,7 @@ class SemesterProcessesController < ApplicationController
def overdue
@semester_process.kind = :reminder
@volunteers = Volunteer.feedback_overdue(@semester_process.semester)
@volunteers = @semester_process.semester_process_volunteers.where(commited_at: nil).map(&:volunteer)
@semester_process.build_semester_volunteers(@volunteers, preselect: true)
@spvs_sorted = sort_volunteers
......@@ -82,12 +82,12 @@ class SemesterProcessesController < ApplicationController
@semester_process.build_semester_volunteers(@volunteers, selected: selected_volunteers, save_records: true)
@semester_process.build_volunteers_feedbacks_and_mails
else
@semester_process.update_attributes(
@semester_process.assign_attributes(
reminder_mail_body_template: semester_process_params[:body],
reminder_mail_subject_template: semester_process_params[:subject]
)
@volunteers = Volunteer.feedback_overdue(@semester_process.semester)
@semester_process.build_volunteers_feedbacks_and_mails(selected_volunteers)
@volunteers = @semester_process.semester_process_volunteers.where(volunteer_id: selected_volunteers).map(&:volunteer)
@semester_process.build_volunteers_feedbacks_and_mails(@volunteers.map(&:id))
end
if @semester_process.save
......
......@@ -84,8 +84,8 @@ class SemesterProcess < ApplicationRecord
def build_volunteers_feedbacks_and_mails(collection = nil)
if collection
SemesterProcessVolunteer.where(volunteer_id: collection).map do |spv|
spv.build_mails(@kind)
semester_process_volunteers.where(volunteer_id: collection).map do |spv|
spv.build_mails(kind)
end
else
@new_semester_process_volunteers.map(&:build_mails)
......
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