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
a32d33bf
Commit
a32d33bf
authored
Nov 20, 2018
by
Jiri Strojil
Browse files
Fixed
parent
8d231538
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/semester_process_volunteers_controller.rb
View file @
a32d33bf
...
...
@@ -40,7 +40,7 @@ class SemesterProcessVolunteersController < ApplicationController
authorize
SemesterProcessVolunteer
semester
=
Semester
.
parse
(
params
[
:semester
])
@semester_process
=
SemesterProcess
.
find_by_semester
(
semester
).
last
@q
=
SemesterProcessVolunteer
.
index
(
semester
).
ransack
(
params
[
:q
])
@q
=
SemesterProcessVolunteer
.
index
(
@
semester
_process
).
ransack
(
params
[
:q
])
@q
.
sorts
=
[
'volunteer_contact_last_name asc'
]
if
@q
.
sorts
.
empty?
@spvs
=
@q
.
result
.
paginate
(
page:
params
[
:page
])
set_responsibles
...
...
app/models/semester_process_volunteer.rb
View file @
a32d33bf
...
...
@@ -33,12 +33,14 @@ class SemesterProcessVolunteer < ApplicationRecord
validates_associated
:hours
,
:semester_feedbacks
,
:volunteer
scope
:index_joins
,
lambda
{
joins
(
:semester_process
).
joins
(
volunteer:
[
:contact
]).
joins
(
:semester_process_volunteer_missions
)
joins
(
:semester_process
).
joins
(
:semester_process_volunteer_missions
,
volunteer:
[
:contact
]
)
}
scope
:index
,
lambda
{
|
semester
=
nil
|
if
semester
index_joins
.
where
(
'semester_processes.semester && daterange(?,?)'
,
semester
.
begin
,
semester
.
end
)
joins
(
:semester_process
).
where
(
semester_process:
semester
)
.
joins
(
:semester_process_volunteer_missions
,
volunteer:
[
:contact
])
.
group
(
'semester_process_volunteers.id, contacts.last_name'
)
else
index_joins
end
...
...
Write
Preview
Markdown
is supported
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