Verified Commit b5456f7f authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

feat(semester-process-volunteer): add builder that creates hours relations, feedbacks and mails

- relations to all hours with meeting date within the semester
- scaffold empty semesterFeedback record for each mission related
- build the SemesterProcessMail.kind == :mail for the initial mail
parent a479287d
......@@ -3,6 +3,9 @@ class SemesterProcessVolunteer < ApplicationRecord
belongs_to :volunteer
belongs_to :semester_process
delegate :semester, to: :semester_process
delegate :creator, to: :semester_process
belongs_to :responsible, -> { with_deleted }, class_name: 'User',
inverse_of: 'semester_processes', optional: true
belongs_to :reviewed_by, -> { with_deleted }, class_name: 'User',
......@@ -37,4 +40,11 @@ class SemesterProcessVolunteer < ApplicationRecord
def build_hours_feedbacks_and_mails
missions.each do |mission|
hours << mission.hours.date_between_inclusion(:meeting_date, semester.begin, semester.end)
semester_feedbacks << mission, volunteer: mission.volunteer)
semester_process_mails << :mail, sent_by: creator)
Supports Markdown
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