Commit 2fa756bc authored by Jiri Strojil's avatar Jiri Strojil
Browse files

Refactored minor things

parent fe73129c
Pipeline #29102 failed with stage
in 13 minutes and 57 seconds
class SemesterProcessVolunteersController < ApplicationController
before_action :skip_authorization #TODO add auth
before_action :set_mission, only: [:show, :edit, :update, :destroy, :review_semester, :submit_review]
before_action :prepare_review, only: [:review_semester, :submit_review]
before_action :initialize_feedback, only: [:review_semester, :submit_review]
include SemesterProcessVolunteerHelper
def review_semester
@volunteer = @semester_process_volunteer.volunteer
@hour = Hour.new
end
def submit_review
@volunteer = @semester_process_volunteer.volunteer
assign_reviewed_attributes
set_reviewed
......@@ -29,15 +27,18 @@ class SemesterProcessVolunteersController < ApplicationController
)
rescue ActiveRecord::RecordInvalid => exception
null_reviewed
@hours.reload
render :review_semester, notice: exception
end
end
private
def set_mission
def prepare_review
# careful cuz mission id can be present in both missions
@semester_process_volunteer = SemesterProcessVolunteer.find(params[:id])
@hours = @semester_process_volunteer.hours
@volunteer = @semester_process_volunteer.volunteer
@mission = @semester_process_volunteer.missions.first
# TODO auths
end
......
......@@ -14,9 +14,9 @@
.col-xs-12= ff.input field
h3 Stunden
= render 'hours/last_submitted_hours', hours: @semester_process_volunteer.hours
= render 'hours/last_submitted_hours', hours: @hours
= f.simple_fields_for :hour, @hour do |hf|
= f.simple_fields_for @hour do |hf|
.row
.col-xs-2.float-right= hf.input :hours, required: false, input_html: { value: f.object.hours == 0 ? '' : f.object.hours}
......
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