实训作业的评阅状态

courseware
cxt 5 years ago
parent f62677b4a2
commit 455957b136

@ -230,7 +230,7 @@ class HomeworkCommonsController < ApplicationController
limit = params[:limit] || 20
@student_works = @student_works.page(page).per(limit)
if @homework.homework_type == "practice"
@student_works = @student_works.includes(:student_works_scores, :shixun_work_comments, user: :user_extension, myshixun: :games)
@student_works = @student_works.includes(:student_works_scores, :shixun_work_comments, :challenge_work_scores, user: :user_extension, myshixun: :games)
else
@student_works = @student_works.includes(:student_works_scores, :project, user: :user_extension)
end

@ -223,6 +223,11 @@ class StudentWork < ApplicationRecord
end
end
# 实训作品是否已被评阅过
def shixun_has_comment?
shixun_work_comments.size > 0 || student_works_scores.size > 0 || challenge_work_scores.size > 0
end
def scored?
student_works_scores.where.not(reviewer_role: 3, score: nil).exists?
end

@ -114,7 +114,7 @@ if @homework.homework_type == "practice"
json.student_id work.user.try(:student_id)
json.group_name @students.select{|student| student.user_id == work.user_id}.first.try(:course_group_name)
json.work_status work.compelete_status
json.has_comment work.shixun_work_comments.size > 0
json.has_comment work.shixun_has_comment?
end
elsif @homework.homework_type == "group" || @homework.homework_type == "normal"
json.anonymous_comment @homework.anonymous_comment

Loading…
Cancel
Save