@ -39,34 +39,34 @@ class StudentWork < ApplicationRecord
# 助教评分次数
# 助教评分次数
def ta_comment_count
def ta_comment_count
self . student_works_scores . where( reviewer_role : 2 ) . group_by ( & :user_id ) . count
self . student_works_scores . select{ | score | score . reviewer_role == 2 } . group_by ( & :user_id ) . count
end
end
# 匿评次数
# 匿评次数
def student_comment_num
def student_comment_num
homework_common . homework_detail_manual . comment_status > 2 ? self . student_works_scores . where( reviewer_role : 3 ) . group_by ( & :user_id ) . count : 0
homework_common . homework_detail_manual . comment_status > 2 ? self . student_works_scores . select{ | score | score . reviewer_role == 3 } . group_by ( & :user_id ) . count : 0
end
end
# 匿评申诉总条数
# 匿评申诉总条数
def appeal_all_count
def appeal_all_count
homework_common . homework_detail_manual . comment_status > = 3 ? self . student_works_scores . where ( " reviewer_role = 3 and appeal_status != 0 " ) .
homework_common . homework_detail_manual . comment_status > = 3 ? self . student_works_scores .
group_by ( & :user_id ) . count : 0
select { | score | score . reviewer_role == 3 && score . appeal_status != 0 } . group_by ( & :user_id ) . count : 0
end
end
# 匿评申诉待处理条数
# 匿评申诉待处理条数
def appeal_deal_count
def appeal_deal_count
homework_common . homework_detail_manual . comment_status > = 3 ? self . student_works_scores . where ( " reviewer_role = 3 and appeal_status = 1 " ) .
homework_common . homework_detail_manual . comment_status > = 3 ? self . student_works_scores .
group_by ( & :user_id ) . count : 0
select { | score | score . reviewer_role == 3 && score . appeal_status == 1 } . group_by ( & :user_id ) . count : 0
end
end
# 当前用户该作品的匿评申诉总条数
# 当前用户该作品的匿评申诉总条数
def my_appeal_all_count user_id
def my_appeal_all_count user_id
student_works_scores . where( " reviewer_role = 3 and appeal_status != 0 and user_id = #{ user_id } " ) . size
student_works_scores . select{ | score | score . reviewer_role == 3 && score . appeal_status != 0 && score . user_id = user_id } . size
end
end
# 当前用户该作品的匿评申诉总条数
# 当前用户该作品的匿评申诉总条数
def my_appeal_deal_count user_id
def my_appeal_deal_count user_id
student_works_scores . where( " reviewer_role = 3 and appeal_status = 1 and user_id = #{ user_id } " ) . size
student_works_scores . select{ | score | score . reviewer_role == 3 && score . appeal_status == 1 && score . user_id = user_id } . size
end
end
# 分组名
# 分组名