Commit 78b1108a authored by Jiri Strojil's avatar Jiri Strojil

Fixed scopes

parent 1b3c4ae7
Pipeline #32963 passed with stage
in 34 minutes and 53 seconds
......@@ -71,8 +71,8 @@ class SemesterProcessVolunteer < ApplicationRecord
end
def build_missions(semester)
new_missions = volunteer.assignments.no_end.start_before(semester.begin) +
volunteer.group_assignments.no_end.start_before(semester.begin)
new_missions = volunteer.assignments.no_end.start_before(semester.end) +
volunteer.group_assignments.no_end.start_before(semester.end)
semester_process_volunteer_missions << new_missions.map do |mission|
SemesterProcessVolunteerMission.new(mission: mission)
......
......@@ -244,10 +244,9 @@ class Volunteer < ApplicationRecord
def self.active_semester_mission(semester)
volunteers = Volunteer.have_mission
prob = semester.end.advance(weeks: -4)
sem_start = semester.begin
vol_with_missions = volunteers.select do |v|
[v.assignments, v.group_assignments].detect do |mission|
mission.where("period_start < ?", prob).where("period_end > ? OR period_end IS NULL", sem_start).any?
mission.where("period_end IS NULL").where("period_start < ?", prob).any?
end
end
vol_with_missions
......
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