Commit 31f42839 authored by Jiri Strojil's avatar Jiri Strojil

Active missions only

parent 80ce11c3
Pipeline #32920 passed with stage
in 34 minutes and 47 seconds
......@@ -35,8 +35,16 @@ class SemesterProcessVolunteer < ApplicationRecord
joins(:semester_process).where(semester_process: semester).joins(:semester_process_mails).where("semester_process_mails.kind = 0")
}
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 > upper(semester_processes.semester))
OR
semester_process_volunteer_missions.group_assignment_id IS NOT NULL AND (group_assignments.period_end is NULL OR group_assignments.period_end > upper(semester_processes.semester))")
.references(:assignments, :group_assignments)
}
scope :index, lambda { |semester = nil|
without_reminders(semester)
active_missions.without_reminders(semester)
}
scope :without_feedback, lambda {
......
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