Commit a32d33bf authored by Jiri Strojil's avatar Jiri Strojil

Fixed

parent 8d231538
......@@ -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
......
......@@ -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
......
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