修改《课程--学生列表:输入有效条件获得搜索结果,对搜索结果按积分排序,却自动返回对所有学生排序》bug

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2015-02-02 17:01:07 +08:00
parent 858b5ea97c
commit 646678c9db
2 changed files with 27 additions and 10 deletions

View File

@ -254,8 +254,8 @@ class CoursesController < ApplicationController
end
@is_remote = true
@result_count = @results.count
@results = paginateHelper @results
@results = paginateHelper @results, 10
@search_name = q
end
def addgroups
@ -428,7 +428,22 @@ class CoursesController < ApplicationController
# @results = paginateHelper @results@score_sort_by = "desc"
@is_remote = true
@score_sort_by = params[:sort_by] if params[:sort_by]
@search_name = params[:search_name] if params[:search_name]
group_id = params[:group_id]
if !@search_name.nil?
if group_id == '0'
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@results = searchmember_by_name(student_homework_score(0,0,0,@score_sort_by), @search_name)
@result_count = @results.count
@results = paginateHelper @results, 10
else
@group = CourseGroup.find(group_id)
@results = searchmember_by_name(student_homework_score(group_id, 0, 0,@score_sort_by),@search_name)
@result_count = @results.count
@results = paginateHelper @results, 10
end
else
if group_id == '0'
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@results = student_homework_score(0,page, 10,@score_sort_by)
@ -440,6 +455,8 @@ class CoursesController < ApplicationController
@results = paginateHelper @results, 10
end
end
end
# 显示每个学生的作业评分详情
def show_member_score

View File

@ -25,7 +25,7 @@
<div class="st_box">
<ul class="st_box_top" style="margin-left: 17px;">
<% if @subPage_title == l(:label_student_list) %>
<li class="ml358"><%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0)) ,:result => members,method: 'get', remote: true%>
<li class="ml358"><%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
<% if @score_sort_by == 'desc' %>
<a id="pic" href="#" class= "st_down"></a>
<% else %>