Verified Commit d32fffc3 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

feat(semester-process-elegible-volunteer): add scope that selects volunteers...

feat(semester-process-elegible-volunteer): add scope that selects volunteers that where with active assignments or group assignments within the given semester
parent a3f0ebf8
......@@ -172,6 +172,17 @@ class Volunteer < ApplicationRecord
.where('assignments.period_start IS NOT NULL OR group_assignments.period_start IS NOT NULL')
}
scope :active_semester_mission, lambda { |semester|
have_mission.where(
'assignments.period_start < :prob OR group_assignments.period_start < :prob',
prob: semester.end.advance(weeks: -4)
).where(
'(assignments.period_end IS NULL OR group_assignments.period_end IS NULL) OR '\
'(assignments.period_end > :begin OR group_assignments.period_end > :begin)',
begin: semester.begin
)
}
scope :will_take_more_assignments, (-> { where(take_more_assignments: true) })
scope :activeness_not_ended, lambda {
......
Supports Markdown
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