班级列表的导出成绩,虽然点击分班后导出成绩做了正确的调整,但是输入检索筛选后导出的依然是全部学生的成绩

This commit is contained in:
cxt 2017-01-10 11:20:59 +08:00
parent fe24382157
commit 720bd6e63e
3 changed files with 9 additions and 4 deletions

View File

@ -187,6 +187,7 @@ class CoursesController < ApplicationController
# @is_remote = true
@sort_type = 'score'
@score_sort_by = "desc"
@search_name = "#{params[:name].strip}"
q = "#{params[:name].strip}"
if params[:incourse]
results = searchmember_by_name(student_homework_score(0,0,0,"desc"), q)
@ -402,6 +403,7 @@ class CoursesController < ApplicationController
@is_remote = true
@sort_type = 'score'
@score_sort_by = "desc"
@search_name = ""
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
@group = CourseGroup.find(params[:group_id])
@results = student_homework_score(@group.id,0, 0,"desc")
@ -455,6 +457,7 @@ class CoursesController < ApplicationController
@is_remote = true
@course_groups = @course.course_groups if @course.course_groups
@show_serch = params[:role] == '2'
@search_name = ""
case @role
when '1'
@subPage_title = l :label_teacher_list
@ -490,15 +493,16 @@ class CoursesController < ApplicationController
end
def export_course_member_excel
q = "#{params[:name].strip}"
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
group = CourseGroup.find params[:group_id]
unless group.nil?
@all_members = student_homework_score(group.id,0,0,"desc")
@all_members = searchmember_by_name(student_homework_score(group.id,0,0,"desc"), q)
end
elsif params[:group_id] && params[:group_id] == "-1"
@all_members = student_homework_score(-1, 0, 10,"desc")
@all_members = searchmember_by_name(student_homework_score(-1, 0, 10,"desc"), q)
else
@all_members = student_homework_score(0, 0, 10,"desc")
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
end
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at asc")

View File

@ -2,5 +2,5 @@
<% if User.current.allowed_to?(:as_teacher,@course) %>
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'link-blue ml10 fr mt5' %>
<% end %>
<%= link_to "导出成绩", export_course_member_excel_course_path(@course,:group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0),:format => 'xls'), :class => 'link-blue fr mt5'%>
<%= link_to "导出成绩", export_course_member_excel_course_path(@course,:group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :name => @search_name,:format => 'xls'), :class => 'link-blue fr mt5'%>
<div class="cl"></div>

View File

@ -3,4 +3,5 @@
*/
$('#new_group_name').hide();
$('#edit_group_form').hide();
$("#course_member_opr").html("<%= escape_javascript( render :partial => 'course_member_opr')%>");
$("#member_content").html("<%= escape_javascript( render :partial => 'new_member_list', :locals => {:members => @results})%>");