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
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:,
journalable_type: 'Volunteer', category: :feedback, title: "Semester Prozess Feedback vom #{I18n.l(}: ",
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(}: ",
body: render_semester_feedbacks(semester_feedbacks))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment