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

feat(semester-process): semester setter, that can parse '2018,1' and build semester daterange

- if passed from form input, it can build the correct semester that was passed from form input
parent a7d3e195
......@@ -26,4 +26,14 @@ class SemesterProcess < ApplicationRecord
# will only return an array, not a AD-result
delegate :missions, to: :semester_process_volunteers
# creates semester date range from string '[year],[semester_number]' e.g. '2018,2'
def semester=(semester)
if semester.is_a?(String)
super(Semester.new(*semester.split(',').map(&:to_i)).current)
else
super(semester)
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