Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
6a8494c9
Commit
6a8494c9
authored
Nov 06, 2018
by
Beat Seeliger
Browse files
Merge branch 'fixes/volunteer-without-assignment' into 'develop'
Fixes/volunteer without assignment See merge request
!832
parents
c1bec6e9
283da174
Pipeline
#30180
failed with stage
in 35 minutes and 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/models/volunteer.rb
View file @
6a8494c9
...
...
@@ -172,21 +172,9 @@ 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
)
}
def
self
.
semester_process_eligible
(
semester
)
joins
(
:contact
).
where
.
not
(
id:
have_semester_process
(
semester
).
ids
)
.
active_semester_mission
(
semester
)
.
group
(
'volunteers.id'
)
end
## Activness Scopes
...
...
@@ -239,6 +227,18 @@ class Volunteer < ApplicationRecord
scope
:need_refunds
,
(
->
{
where
(
waive:
false
)
})
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?
end
end
vol_with_missions
end
def
self
.
with_billable_hours
(
date
=
nil
)
date
=
billable_semester_date
(
date
)
need_refunds
.
left_joins
(
:contact
,
:hours
,
:billing_expenses
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment