排序功能
This commit is contained in:
parent
9c20368274
commit
b8cb422268
|
@ -76,19 +76,22 @@ class StudentWorkController < ApplicationController
|
||||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||||
@is_evaluation = @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
|
@is_evaluation = @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
|
||||||
|
@show_all = false
|
||||||
if @is_teacher #老师 || 超级管理员 显示所有列表
|
if @is_teacher #老师 || 超级管理员 显示所有列表
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||||
|
@show_all = true
|
||||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前只看到自己的,提交了作品看到所有的
|
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||||
if my_work.empty?
|
if my_work.empty?
|
||||||
@stundet_works = []
|
@stundet_works = []
|
||||||
else
|
else
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||||
|
@show_all = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@stundet_works = []
|
@stundet_works = []
|
||||||
|
|
|
@ -3,25 +3,35 @@
|
||||||
<span class="c_dark f14 fb fl ml10">作品信息</span>
|
<span class="c_dark f14 fb fl ml10">作品信息</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="hworkList80" >
|
<li class="hworkList80" >
|
||||||
<span class="c_dark f14 fb fl ml10">教师评分</span>
|
<%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
|
||||||
<a href="javascript:void(0);" class="st_up mt19" ></a>
|
<% if @show_all && @order == "teacher_score"%>
|
||||||
|
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt19"%>
|
||||||
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
<li class="hworkList80">
|
<li class="hworkList80">
|
||||||
<span class="c_dark f14 fb fl ml10">教辅评分</span>
|
<%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
|
||||||
<a href="javascript:void(0);" class="st_up mt19" ></a>
|
<% if @show_all && @order == "teaching_asistant_score"%>
|
||||||
|
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt19"%>
|
||||||
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
<% if @homework.homework_type == 2%>
|
<% if @homework.homework_type == 2%>
|
||||||
<li class="hworkList80">
|
<li class="hworkList80">
|
||||||
<span class="c_dark f14 fb fl ml10">系统评分</span>
|
<%= link_to "系统评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
|
||||||
<a href="javascript:void(0);" class="st_up mt19" ></a>
|
<% if @show_all && @order == "system_score"%>
|
||||||
|
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt19"%>
|
||||||
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
<% end%>
|
<% end%>
|
||||||
<li class="hworkList50">
|
<li class="hworkList50">
|
||||||
<span class="c_dark f14 fb fl ml5">匿评</span>
|
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
|
||||||
<a href="javascript:void(0);" class="st_up mt19" ></a>
|
<% if @show_all && @order == "student_score"%>
|
||||||
|
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt19"%>
|
||||||
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
<li class="hworkList50">
|
<li class="hworkList50">
|
||||||
<span class="c_dark f14 fb fl ml5">成绩</span>
|
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10"%>
|
||||||
<a href="javascript:void(0);" class="st_down mt19" ></a>
|
<% if @show_all && @order == "score"%>
|
||||||
|
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt19"%>
|
||||||
|
<% end%>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
Loading…
Reference in New Issue