Commit ed9f8bd0 authored by Jiri Strojil's avatar Jiri Strojil
Browse files

Setter in hour

parent 1182f9e4
Pipeline #30766 failed with stage
in 35 minutes and 57 seconds
......@@ -56,7 +56,6 @@ class SemesterProcessVolunteersController < ApplicationController
if hash[:hour][:hours]&.to_i.positive?
spv_mission = SemesterProcessVolunteerMission.find(hash[:hour][:spv_mission_id])
@hours << Hour.new(hash[:hour].merge({
hourable: spv_mission.mission.group_assignment? ? spv_mission.mission.group_offer : spv_mission.mission,
volunteer: spv_mission.volunteer,
meeting_date: Time.zone.now,
semester_process_volunteer: @semester_process_volunteer
......
......@@ -47,6 +47,11 @@ class Hour < ApplicationRecord
attr_reader :spv_mission_id
def spv_mission_id= id
spv_mission = SemesterProcessVolunteerMission.find(id)
self.hourable = spv_mission.mission.group_assignment? ? spv_mission.mission.group_offer : spv_mission.mission
end
def assignment?
hourable_type == 'Assignment'
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