学生打开分组作业列表报500

This commit is contained in:
cxt 2016-02-20 18:26:52 +08:00
parent 84a1397a7a
commit ba66425bef
1 changed files with 30 additions and 6 deletions

View File

@ -98,14 +98,22 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3 if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first pro = @homework.student_work_projects.where(:user_id => User.current.id).first
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) if pro.nil?
@stundet_works = []
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
end
else else
@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)
end end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3 if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.where(:id => pro.student_work_id) if pro.nil?
my_work = []
else
my_work = @homework.student_works.where(:id => pro.student_work_id)
end
else else
my_work = @homework.student_works.where(:user_id => User.current.id) my_work = @homework.student_works.where(:user_id => User.current.id)
end end
@ -113,7 +121,11 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
if @homework.homework_type == 3 if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) if pro.nil?
my_work = []
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
end
else else
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)
end end
@ -134,14 +146,22 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3 if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first pro = @homework.student_work_projects.where(:user_id => User.current.id).first
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) if pro.nil?
@stundet_works = []
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
end
else else
@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)
end end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3 if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.where(:id => pro.student_work_id) if pro.nil?
my_work = []
else
my_work = @homework.student_works.where(:id => pro.student_work_id)
end
else else
my_work = @homework.student_works.where(:user_id => User.current.id) my_work = @homework.student_works.where(:user_id => User.current.id)
end end
@ -149,7 +169,11 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
if @homework.homework_type == 3 if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) if pro.nil?
my_work = []
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
end
else else
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)
end end