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

feat(semester-process): builder for creating SemesterProcessVolunteer

- takes query of elegible volunteers and then builds SemesterProcessVolunteer for each
- if array of volunteer ids is passed, it will only build SemesterProcessVolunteer for these
parent cf1adbaa
......@@ -36,4 +36,12 @@ class SemesterProcess < ApplicationRecord
end
end
def build_semester_volunteers(volunteers, selected = nil)
volunteers = volunteers.where(id: selected) if selected
semester_process_volunteers << volunteers.to_a.map do |volunteer|
spv = SemesterProcessVolunteer.new(volunteer: volunteer, selected: true)
spv.build_missions(semester)
spv
end
end
end
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