Commit 160b3367 authored by Tugce Nur Tas's avatar Tugce Nur Tas
Browse files

show exact semester period dates on review_semester for hours

parent 91ddfe83
Pipeline #30697 passed with stage
in 35 minutes and 47 seconds
......@@ -14,7 +14,6 @@ class SemesterProcessesController < ApplicationController
@semester_process.build_semester_volunteers(@volunteers)
authorize @semester_process
@spvs_sorted = @semester_process.semester_process_volunteers.sort { |spv1, spv2| spv1.volunteer.contact.full_name <=> spv2.volunteer.contact.full_name}
@seme
if EmailTemplate.half_year_process_email.active.any?
template = EmailTemplate.half_year_process_email.active.first.slice(:subject, :body)
@semester_process.assign_attributes(mail_body_template: template[:body], mail_subject_template: template[:subject])
......
......@@ -64,6 +64,10 @@ class SemesterProcess < ApplicationRecord
Semester.i18n_t(semester, short: short)
end
def semester_period
Semester.period(semester)
end
def build_semester_volunteers(volunteers, selected = nil)
volunteers = volunteers.where(id: selected) if selected
semester_process_volunteers << volunteers.to_a.map do |volunteer|
......
......@@ -5,6 +5,7 @@ class SemesterProcessVolunteer < ApplicationRecord
belongs_to :semester_process
delegate :semester, to: :semester_process
delegate :semester_t, to: :semester_process
delegate :semester_period, to: :semester_process
delegate :creator, to: :semester_process
belongs_to :responsible, -> { with_deleted }, class_name: 'User',
......@@ -43,7 +44,6 @@ class SemesterProcessVolunteer < ApplicationRecord
end
}
# will only return an array, not a AD-result
def missions
semester_process_volunteer_missions.map(&:mission)
......
......@@ -60,6 +60,10 @@ class Semester
end
end
def period(semester)
I18n.t(:semester_period, begin: I18n.l(semester.begin.to_date), end: I18n.l(semester.end.to_date))
end
def semester_start_time(date_time)
date_time = date_time.to_date
if (6..11).cover?(date_time.month)
......
......@@ -18,8 +18,9 @@
= f.simple_fields_for @hour do |hf|
.row
.col-xs-2= hf.input :hours, label: 'Restliche Stunden in diesem Semester',
required: false, input_html: { value: f.object.hours == 0 ? '' : f.object.hours}
.col-xs-2= hf.input :hours,
label: "Restliche Stunden in diesem Semester #{@semester_process_volunteer.semester_period}",
required: false, input_html: { value: f.object.hours == 0 ? '' : f.object.hours}
h3 Spesen
= f.simple_fields_for :volunteer, @volunteer do |vf|
......
......@@ -189,6 +189,7 @@ de:
volunteer: Freiwillige/r
semester_long: '%{number}. Semester %{year} (%{begin} - %{end})'
semester_short: '%{number}. Semester %{year}'
semester_period: '%{begin} - %{end}'
semester_process_volunteers:
show:
title: 'Semester Prozess %{semester} von %{name}'
......
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