Commit 07320044 authored by Jiri Strojil's avatar Jiri Strojil

Fixed logic

parent ae0d01c6
Pipeline #32960 passed with stage
in 35 minutes and 14 seconds
......@@ -15,7 +15,7 @@ class SemesterProcessVolunteer < ApplicationRecord
belongs_to :commited_by, -> { with_deleted }, class_name: 'User',
inverse_of: 'semester_processes', optional: true
has_many :semester_process_volunteer_missions, -> { active_missions }, dependent: :destroy
has_many :semester_process_volunteer_missions, dependent: :destroy
has_many :assignments, through: :semester_process_volunteer_missions
has_many :group_assignments, through: :semester_process_volunteer_missions
......
......@@ -4,13 +4,13 @@ class SemesterProcessVolunteerMission < ApplicationRecord
delegate :volunteer, to: :semester_process_volunteer
belongs_to :semester_process_volunteer
scope :active_missions, lambda {
scope :need_feedback, lambda {
joins(semester_process_volunteer: [:semester_process]).includes(:assignment, :group_assignment)
.where("semester_process_volunteer_missions.assignment_id IS NOT NULL AND
(assignments.period_end IS NULL OR assignments.period_end >= lower(semester_processes.semester))
.where("(semester_process_volunteer_missions.assignment_id IS NOT NULL AND
assignments.period_end IS NULL)
OR
semester_process_volunteer_missions.group_assignment_id IS NOT NULL AND
(group_assignments.period_end is NULL OR group_assignments.period_end >= lower(semester_processes.semester))")
(semester_process_volunteer_missions.group_assignment_id IS NOT NULL AND
group_assignments.period_end is NULL)")
.references(:assignments, :group_assignments)
}
end
......@@ -8,7 +8,7 @@
.col-xs-12
p.text-danger Bestätigt am #{l(@semester_process_volunteer.commited_at.to_date)} durch #{profile_link(@semester_process_volunteer.commited_by)}
= f.simple_fields_for :semester_feedbacks, @semester_process_volunteer.semester_process_volunteer_missions do |spvm|
= f.simple_fields_for :semester_feedbacks, @semester_process_volunteer.semester_process_volunteer_missions.need_feedback do |spvm|
- mission = spvm.object.mission
h2.m-b-20.m-t-30 Einsatz #{mission.to_label}
......
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