未启用匿评的作业,学生在提交作品之前无法看到其他学生的作品

This commit is contained in:
sw 2015-06-02 16:56:15 +08:00
parent 9f03e39e86
commit ad296e43b2
1 changed files with 10 additions and 1 deletions

View File

@ -13,7 +13,16 @@ class StudentWorkController < ApplicationController
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
if @show_all
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
if @homework.homework_type == 1 || @is_teacher || User.current.admin?
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
else
my_work = @homework.student_works.where(:user_id => User.current.id)
if my_work.empty?
@stundet_works = []
else
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
end
end
else #学生
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
@stundet_works = @homework.student_works.where(:user_id => User.current.id)