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

feat(semester-process-volunteer): builder that assigns the elegible missions...

feat(semester-process-volunteer): builder that assigns the elegible missions from the volunteer to the SemesterProcessVolunteerMission join table relation
parent ece24e92
......@@ -27,4 +27,14 @@ class SemesterProcessVolunteer < ApplicationRecord
def missions
semester_process_volunteer_missions.map(&:mission)
end
def build_missions(semester)
new_missions = volunteer.assignments.active_between(semester.begin, semester.end) +
volunteer.group_assignments.active_between(semester.begin, semester.end)
semester_process_volunteer_missions << new_missions.map do |mission|
SemesterProcessVolunteerMission.new(mission: mission)
end
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