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
b5b152fe
Commit
b5b152fe
authored
Oct 30, 2018
by
Jiri Strojil
Browse files
Refactored fnc
parent
f2ed1edf
Pipeline
#29703
failed with stage
in 35 minutes and 33 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/models/volunteer.rb
View file @
b5b152fe
...
...
@@ -175,6 +175,7 @@ class Volunteer < ApplicationRecord
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
...
...
@@ -231,15 +232,12 @@ class Volunteer < ApplicationRecord
volunteers
=
Volunteer
.
have_mission
prob
=
semester
.
end
.
advance
(
weeks:
-
4
)
sem_start
=
semester
.
begin
vol_with_assignments
=
volunteers
.
select
do
|
v
|
v
.
assignments
.
where
(
"period_start < ?"
,
prob
).
where
(
"period_end > ? OR period_end IS NULL"
,
sem_start
).
any?
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_group_assignments
=
volunteers
.
select
do
|
v
|
v
.
group_assignments
.
where
(
"period_start < ?"
,
prob
).
where
(
"period_end > ? OR period_end IS NULL"
,
sem_start
).
any?
end
(
vol_with_assignments
+
vol_with_group_assignments
).
uniq
vol_with_missions
end
def
self
.
with_billable_hours
(
date
=
nil
)
...
...
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