Commit 5d3baa92 authored by Tugce Nur Tas's avatar Tugce Nur Tas

first try to implement new way of termination feedback

parent 3c180e3d
Pipeline #17342 failed with stage
in 45 minutes and 14 seconds
......@@ -76,6 +76,7 @@ class GroupAssignmentsController < ApplicationController
.merge(termination_submitted_at: Time.zone.now, termination_submitted_by: current_user))
if @group_assignment.save && terminate_reminder_mailing
NotificationMailer.termination_submitted(@group_assignment).deliver_now
@group_assignment.create_termination_hours
redirect_to @group_assignment.volunteer,
notice: 'Der Gruppeneinsatz ist hiermit abgeschlossen.'
else
......@@ -135,7 +136,7 @@ class GroupAssignmentsController < ApplicationController
def group_assignment_params
params.require(:group_assignment).permit(
:period_start, :period_end, :termination_submitted_at, :terminated_at, :responsible,
:term_feedback_activities, :term_feedback_problems, :term_feedback_success,
:term_feedback_activities, :term_feedback_problems, :term_feedback_success, :term_hours,
:redirect_to, :term_feedback_transfair, :comments, :additional_comments,
:trial_period_end, :frequency, :description, :place, :happens_at, :agreement_text,
:group_offer_id, :volunteer_id, volunteer_attributes: [:waive]
......
......@@ -35,6 +35,16 @@ class GroupAssignment < ApplicationRecord
)
end
def create_termination_hours(record = term_hours)
Hour.create!(
meeting_date: period_end,
hours: record,
volunteer_id: volunteer.id,
hourable_id: id,
hourable_type: 'GroupOffer'
)
end
def hours_since_last_submitted
group_offer.hours.since_last_submitted(submitted_at)
end
......
......@@ -23,18 +23,8 @@ dl.dl-horizontal
@group_assignment.department, target: '_blank')
dt Einsatzdauer:
dd= "#{l(@group_assignment.period_start)} bis #{l(@group_assignment.period_end)}" if @group_assignment.period_start.present?
hr
h2 Bisherige Einträge
h3 Stunden
= render 'last_submitted_hours', hours: @group_assignment.hours, confirmable: @group_assignment
p= button_link t_title(:new, Hour), new_polymorphic_path([@group_assignment.volunteer, @group_assignment.group_offer, Hour], redirect_to: :terminate, group_assignment: @group_assignment.id)
h3 Bisheriges Feedback
= render 'last_submitted_feedbacks', feedbacks: @group_assignment.feedbacks, confirmable: @group_assignment
p= button_link t_title(:new, Feedback), new_polymorphic_path([@group_assignment.volunteer, @group_assignment.group_offer, Feedback], redirect_to: :terminate, group_assignment: @group_assignment.id)
dt Total bisherige Stunden:
dd= @group_assignment.volunteer.hours.total_hours
hr
- if @group_assignment.termination_feedback_submitted?
......@@ -63,6 +53,7 @@ hr
= f.input :term_feedback_success
= f.input :term_feedback_problems
= f.input :term_feedback_transfair
= f.input :term_hours
fieldset
label.text-bigger-2 Spesen
......
......@@ -5,11 +5,13 @@ de:
term_feedback_success: 'Endfeedback: Erfolge'
term_feedback_problems: 'Endfeedback: Probleme'
term_feedback_transfair: 'Endfeedback: TransFair'
term_hours: 'Restliche Stunden'
termination_feedback_questions: &id-termination-feedback-quests
term_feedback_activities: Was waren Ihre Hauptaktivitäten während des Einsatzes?
term_feedback_success: Welche Erfolge oder Highlights haben Sie während Ihres Einsatzes erlebt?
term_feedback_problems: Welchen Schwierigkeiten in Bezug auf Ihren Einsatz sind Sie begegnet?
term_feedback_transfair: Wie fanden Sie die von TransFair angebotene Unterstützung inklusive Weiterbildungen und Anlässe?
term_hours: 'Restliche Stunden'
reminder_mailings:
kinds: &id-kinds-enum-values
trial_period: Probezeit
......
class AddTerminationHoursToAssignments < ActiveRecord::Migration[5.1]
def change
add_column :group_assignments, :term_hours, :float, default: 0.0
add_column :group_assignment_logs, :term_hours, :float, default: 0.0
add_column :assignments, :term_hours, :float, default: 0.0
add_column :assignment_logs, :term_hours, :float, default: 0.0
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180403135553) do
ActiveRecord::Schema.define(version: 20180404173459) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -54,6 +54,7 @@ ActiveRecord::Schema.define(version: 20180403135553) do
t.string "duration"
t.string "special_agreement"
t.text "agreement_text"
t.float "term_hours", default: 0.0
t.index ["assignment_id"], name: "index_assignment_logs_on_assignment_id"
t.index ["client_id"], name: "index_assignment_logs_on_client_id"
t.index ["creator_id"], name: "index_assignment_logs_on_creator_id"
......@@ -107,6 +108,7 @@ ActiveRecord::Schema.define(version: 20180403135553) do
t.string "duration"
t.string "special_agreement"
t.text "agreement_text", default: "Freiwillige beachten folgende Grundsätze während ihres Einsatzes in der AOZ:\n* Verhaltenskodex für Freiwillige\n* Rechte und Pflichten für Freiwillige\n* AOZ Leitlinien Praktische Integrationsarbeit\n\nAllenfalls auch\n* Verpflichtungserklärung zum Schutz der unbegleiteten minderjährigen Asylsuchenden (MNA)\n* Niederschwellige Gratis-Deutschkurse: Informationen für freiwillige Kursleitende\n"
t.float "term_hours", default: 0.0
t.index ["client_id"], name: "index_assignments_on_client_id"
t.index ["creator_id"], name: "index_assignments_on_creator_id"
t.index ["period_end"], name: "index_assignments_on_period_end"
......@@ -342,6 +344,7 @@ ActiveRecord::Schema.define(version: 20180403135553) do
t.string "frequency"
t.string "trial_period_end"
t.text "agreement_text"
t.float "term_hours", default: 0.0
t.index ["deleted_at"], name: "index_group_assignment_logs_on_deleted_at"
t.index ["group_assignment_id"], name: "index_group_assignment_logs_on_group_assignment_id"
t.index ["group_offer_id"], name: "index_group_assignment_logs_on_group_offer_id"
......@@ -379,6 +382,7 @@ ActiveRecord::Schema.define(version: 20180403135553) do
t.string "frequency"
t.string "trial_period_end"
t.text "agreement_text", default: "Freiwillige beachten folgende Grundsätze während ihres Einsatzes in der AOZ:\n* Verhaltenskodex für Freiwillige\n* Rechte und Pflichten für Freiwillige\n* AOZ Leitlinien Praktische Integrationsarbeit\n\nAllenfalls auch\n* Verpflichtungserklärung zum Schutz der unbegleiteten minderjährigen Asylsuchenden (MNA)\n* Niederschwellige Gratis-Deutschkurse: Informationen für freiwillige Kursleitende\n"
t.float "term_hours", default: 0.0
t.index ["deleted_at"], name: "index_group_assignments_on_deleted_at"
t.index ["group_offer_id"], name: "index_group_assignments_on_group_offer_id"
t.index ["period_end"], name: "index_group_assignments_on_period_end"
......
Markdown is supported
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