Commit 02ebb23e authored by Jiri Strojil's avatar Jiri Strojil

Fixed logic

parent 07320044
......@@ -37,11 +37,11 @@ class SemesterProcessVolunteer < ApplicationRecord
scope :active_missions, lambda {
joins(:semester_process_volunteer_missions).includes(semester_process_volunteer_missions: [: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)
}
......
......@@ -5,7 +5,7 @@ class SemesterProcessVolunteerMission < ApplicationRecord
belongs_to :semester_process_volunteer
scope :need_feedback, lambda {
joins(semester_process_volunteer: [:semester_process]).includes(:assignment, :group_assignment)
includes(:assignment, :group_assignment)
.where("(semester_process_volunteer_missions.assignment_id IS NOT NULL AND
assignments.period_end IS NULL)
OR
......
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