@ -11,9 +11,11 @@ module Admin
|
||||
|
||||
# TODO: Limit results to the quizzes current_user has access to
|
||||
def index
|
||||
sort_case = "(case when review_status = 0 then '' else name end)"
|
||||
sort_with_case = sort_column == 'name' ? sort_case : sort_column
|
||||
@candidates = Candidate.where(completed: true)
|
||||
.includes(:recruiter)
|
||||
.order("#{sort_column} #{sort_direction}")
|
||||
.order("#{sort_with_case} #{sort_direction}")
|
||||
.page(params[:page])
|
||||
end
|
||||
|
||||
@ -28,7 +30,7 @@ module Admin
|
||||
private
|
||||
|
||||
def sort_column
|
||||
Candidate.column_names.include?(params[:sort]) ? params[:sort] : 'completed_at'
|
||||
@sort_col ||= Candidate.column_names.include?(params[:sort]) ? params[:sort] : 'completed_at'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user