Commit 5c5a4bfd authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

Merge branch...

Merge branch 'fixes/submit_half_year_feedback_does_not_work_because_of_client_having_invalid_permit_entry' into 'develop'

Fixes/submit half year feedback does not work because of client having invalid permit entry

See merge request !805
parents 01162e56 42f316e8
Pipeline #23752 passed with stage
in 34 minutes and 59 seconds
......@@ -99,9 +99,17 @@ class AssignmentsController < ApplicationController
end
def submit_feedback
@assignment.update(assignment_params.slice(:volunteer_attributes)
.merge(submit_feedback: current_user))
redirect_to default_redirect || hours_and_feedbacks_submitted_assignments_path
@assignment.volunteer.assign_attributes(assignment_feedback_params[:volunteer_attributes]
.slice(:waive, :bank, :iban))
@assignment.submit_feedback = current_user
if @assignment.save
redirect_to default_redirect || hours_and_feedbacks_submitted_assignments_path
else
redirect_to(
last_submitted_hours_and_feedbacks_assignment_path(@assignment),
notice: 'Das bestätigen des Feedbacks ist fehlgeschlagen.'
)
end
end
def terminate
......@@ -172,6 +180,10 @@ class AssignmentsController < ApplicationController
authorize @assignment
end
def assignment_feedback_params
params.require(:assignment).permit(volunteer_attributes: [:waive, :iban, :bank])
end
def assignment_params
params.require(:assignment).permit(
:client_id, :volunteer_id, :period_start, :period_end,
......
......@@ -62,9 +62,17 @@ class GroupAssignmentsController < ApplicationController
end
def submit_feedback
@group_assignment.update(group_assignment_params.slice(:volunteer_attributes)
.merge(submit_feedback: current_user))
redirect_to default_redirect || hours_and_feedbacks_submitted_assignments_path
@group_assignment.volunteer.assign_attributes(group_assignment_params[:volunteer_attributes]
.slice(:waive, :bank, :iban))
@group_assignment.submit_feedback = current_user
if @group_assignment.save
redirect_to default_redirect || hours_and_feedbacks_submitted_assignments_path
else
redirect_to(
last_submitted_hours_and_feedbacks_group_assignment_path(@assignment),
notice: 'Das bestätigen des Feedbacks ist fehlgeschlagen.'
)
end
end
def terminate; 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