作品列表的分数查看权限

dev_forum
cxt 6 years ago
parent 114173cec4
commit b6216e2997

@ -121,23 +121,26 @@ class HomeworkCommonsController < ApplicationController
@work = @homework.user_work(current_user.id)
# 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段
if @work.work_status > 0 && @homework.work_public &&
if @work&.work_status.to_i > 0 && @homework.work_public &&
((!@homework.anonymous_comment && @homework.end_or_late) || @homework_detail_manual.comment_status > 4)
@student_works = student_works.where("user_id != #{@work.id}")
# 匿评、申诉阶段只能看到分配给自己的匿评作品
elsif @work.work_status > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2
elsif @work&.work_status.to_i > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2
@is_evaluation = true
@student_works = student_works.joins(:student_works_evaluation_distributions).where(
"student_works_evaluation_distributions.user_id = #{@current_user.id}")
else
@student_works = []
end
@score_open = @homework.score_open && @work&.work_status.to_i > 0
elsif @user_course_identity < Course::STUDENT
@student_works = @homework.teacher_works(@member)
@all_member_count = @student_works.size
@score_open = true
elsif @user_course_identity > Course::STUDENT && @homework.work_public
@student_works = student_works
@score_open = false
else
@student_works = []
end

@ -33,19 +33,19 @@ elsif @user_course_identity == Course::STUDENT
json.late_penalty @work.late_penalty if @homework.allow_late
json.cost_time @work.myshixun.try(:total_cost_time)
json.work_score work_score_format(@work.work_score, true, @homework.score_open)
json.final_score work_score_format(@work.final_score, true, @homework.score_open)
json.efficiency work_score_format(@work.efficiency, true, @homework.score_open)
json.eff_score work_score_format(@work.eff_score, true, @homework.score_open)
json.work_score work_score_format(@work.work_score, true, @score_open)
json.final_score work_score_format(@work.final_score, true, @score_open)
json.efficiency work_score_format(@work.efficiency, true, @score_open)
json.eff_score work_score_format(@work.eff_score, true, @score_open)
json.complete_count @work.myshixun.try(:passed_count)
else
json.(@work, :id, :work_status, :update_time, :ultimate_score)
json.work_score work_score_format(@work.work_score, true, @homework.score_open)
json.final_score work_score_format(@work.final_score, true, @homework.score_open)
json.teacher_score work_score_format(@work.teacher_score, true, @homework.score_open)
json.student_score work_score_format(@work.student_score, true, @homework.score_open)
json.teaching_asistant_score work_score_format(@work.teaching_asistant_score, true, @homework.score_open)
json.work_score work_score_format(@work.work_score, true, @score_open)
json.final_score work_score_format(@work.final_score, true, @score_open)
json.teacher_score work_score_format(@work.teacher_score, true, @score_open)
json.student_score work_score_format(@work.student_score, true, @score_open)
json.teaching_asistant_score work_score_format(@work.teaching_asistant_score, true, @score_open)
json.ta_comment_count @work.ta_comment_count
@ -84,10 +84,10 @@ if @homework.homework_type == "practice"
json.(work, :id, :work_status, :update_time, :ultimate_score)
json.late_penalty work.late_penalty if @homework.allow_late
json.work_score work_score_format(work.work_score, @current_user == work.user, @homework.score_open)
json.final_score work_score_format(work.final_score, @current_user == work.user, @homework.score_open)
json.efficiency work_score_format(work.efficiency, @current_user == work.user, @homework.score_open)
json.eff_score work_score_format(work.eff_score, @current_user == work.user, @homework.score_open)
json.work_score work_score_format(work.work_score, @current_user == work.user, @score_open)
json.final_score work_score_format(work.final_score, @current_user == work.user, @score_open)
json.efficiency work_score_format(work.efficiency, @current_user == work.user, @score_open)
json.eff_score work_score_format(work.eff_score, @current_user == work.user, @score_open)
json.cost_time work.myshixun.try(:total_cost_time)
json.complete_count work.myshixun.try(:passed_count)
@ -117,11 +117,11 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal"
:teaching_asistant_score, :ultimate_score)
json.late_penalty work.late_penalty if @homework.allow_late
json.work_score work_score_format(work.work_score, @current_user == work.user, @homework.score_open)
json.final_score work_score_format(work.final_score, @current_user == work.user, @homework.score_open)
json.teacher_score work_score_format(work.teacher_score, @current_user == work.user, @homework.score_open)
json.student_score work_score_format(work.student_score, @current_user == work.user, @homework.score_open)
json.teaching_asistant_score work_score_format(work.teaching_asistant_score, @current_user == work.user, @homework.score_open)
json.work_score work_score_format(work.work_score, @current_user == work.user, @score_open)
json.final_score work_score_format(work.final_score, @current_user == work.user, @score_open)
json.teacher_score work_score_format(work.teacher_score, @current_user == work.user, @score_open)
json.student_score work_score_format(work.student_score, @current_user == work.user, @score_open)
json.teaching_asistant_score work_score_format(work.teaching_asistant_score, @current_user == work.user, @score_open)
# 助教评分次数
json.ta_comment_count work.ta_comment_count

Loading…
Cancel
Save