Commit 4def498c authored by Chrysanthi Lagodimou's avatar Chrysanthi Lagodimou

Reduce number of queries for create journals

parent 5f878404
Pipeline #32541 passed with stage
in 55 minutes and 22 seconds
......@@ -30,11 +30,12 @@ module SemesterProcessVolunteerHelper
end
def create_journals
return unless SemesterProcessVolunteer.find(params[:id]).commited_at?
volunteer = SemesterProcessVolunteer.find(params[:id]).volunteer
semester_feedbacks = SemesterProcessVolunteer.find(params[:id]).semester_feedbacks
Journal.create(user: volunteer.user, journalable_id: volunteer.id,
journalable_type: 'Volunteer', category: :feedback, title: "Semester Prozess Feedback vom #{I18n.l(Time.zone.today)}: ",
spv = SemesterProcessVolunteer.find(params[:id])
return unless spv.commited_at?
volunteer = spv.volunteer
semester_feedbacks = spv.semester_feedbacks
Journal.create(user: volunteer.user, journalable: volunteer,
category: :feedback, title: "Semester Prozess Feedback vom #{I18n.l(Time.zone.today)}: ",
body: render_semester_feedbacks(semester_feedbacks))
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