匿评作品列表调整

dev_forum
cxt 6 years ago
parent c5afd9fea0
commit aa8b8accc1

@ -59,6 +59,16 @@ class StudentWork < ApplicationRecord
group_by(&:user_id).count : 0
end
# 当前用户该作品的匿评申诉总条数
def my_appeal_all_count user_id
student_works_scores.where("reviewer_role = 3 and appeal_status != 0 and user_id = #{user_id}").size
end
# 当前用户该作品的匿评申诉总条数
def my_appeal_deal_count user_id
student_works_scores.where("reviewer_role = 3 and appeal_status = 1 and user_id = #{user_id}").size
end
# 分组名
def work_group_name
self.group_id == 0 ? "--" : "分组#{self.group_id}"

@ -106,6 +106,12 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal"
json.student_score work_score_format(anon_comments(@current_user, work.id).last.try(:score), false, true)
# json.student_comment_count anon_comments(@current_user, work.id).count
# 申诉条数
if @homework.anonymous_appeal
json.appeal_all_count work.my_appeal_all_count @current_user.id
json.appeal_deal_count work.my_appeal_deal_count @current_user.id
end
else
json.(work, :id, :work_status, :update_time, :work_score, :final_score, :teacher_score, :student_score,
:teaching_asistant_score, :ultimate_score)
@ -134,13 +140,13 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal"
end
json.work_group work.work_group_name
end
end
# 申诉条数
if @homework.anonymous_appeal
json.appeal_all_count work.appeal_all_count
json.appeal_deal_count work.appeal_deal_count
json.appeal_penalty work.appeal_penalty
# 申诉条数
if @homework.anonymous_appeal
json.appeal_all_count work.appeal_all_count
json.appeal_deal_count work.appeal_deal_count
json.appeal_penalty work.appeal_penalty
end
end
json.user_login @is_evaluation ? "--" : work.user.try(:login)

Loading…
Cancel
Save