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