|
|
|
@ -8,12 +8,15 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
before_action :find_work, only: [:shixun_work_report, :adjust_review_score, :shixun_work, :commit_des, :update_des,
|
|
|
|
|
:adjust_score, :show, :adjust_score, :supply_attachments, :revise_attachment,
|
|
|
|
|
:comment_list, :add_score, :add_score_reply, :destroy_score, :appeal_anonymous_score,
|
|
|
|
|
:deal_appeal_score, :cancel_appeal, :edit, :update, :export_shixun_work_report]
|
|
|
|
|
:deal_appeal_score, :cancel_appeal, :edit, :update, :export_shixun_work_report,
|
|
|
|
|
:shixun_work_comment, :destroy_work_comment]
|
|
|
|
|
before_action :user_course_identity
|
|
|
|
|
before_action :allow_add_score, only: [:add_score]
|
|
|
|
|
before_action :homework_publish
|
|
|
|
|
|
|
|
|
|
before_action :teacher_allowed, only: [:adjust_score, :adjust_review_score, :deal_appeal_score]
|
|
|
|
|
before_action :teacher_allowed, only: [:adjust_score, :adjust_review_score, :deal_appeal_score, :shixun_work_comment,
|
|
|
|
|
:destroy_work_comment]
|
|
|
|
|
|
|
|
|
|
before_action :course_student, only: [:new, :commit_des, :update_des, :create, :edit, :update, :search_member_list, :relate_project,
|
|
|
|
|
:cancel_relate_project, :relate_project, :delete_work]
|
|
|
|
|
|
|
|
|
@ -455,6 +458,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
@shixun = @homework.shixuns.take
|
|
|
|
|
# 提示: 这里如果includes outputs表的话: sum(:evaluate_count)会出现错误
|
|
|
|
|
@games = @work.myshixun.games.joins(:challenge).reorder("challenges.position asc") if @work.myshixun
|
|
|
|
|
@comment = @work.student_works_scores.shixun_comment.first
|
|
|
|
|
|
|
|
|
|
# 用户最大评测次数
|
|
|
|
|
if @games
|
|
|
|
@ -468,6 +472,23 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
@echart_data = student_efficiency(@homework, @work)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 实训作品的评阅
|
|
|
|
|
def shixun_work_comment
|
|
|
|
|
tip_exception("评阅不能为空") if params[:comment].blank?
|
|
|
|
|
tip_exception("缺少is_hidden参数") if params[:is_hidden].blank? || ![true, false].include?(params[:is_hidden])
|
|
|
|
|
comment = @work.student_works_scores.shixun_comment.first || StudentWorksScore.new(student_work_id: @work.id, user_id: current_user.id)
|
|
|
|
|
comment.comment = params[:comment]
|
|
|
|
|
comment.is_hidden = params[:is_hidden]
|
|
|
|
|
comment.save!
|
|
|
|
|
normal_status("评阅成功")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 删除实训作品评阅
|
|
|
|
|
def destroy_work_comment
|
|
|
|
|
@work.student_works_scores.shixun_comment.first.destroy! if @work.student_works_scores.shixun_comment.first.present?
|
|
|
|
|
normal_status("删除成功")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def export_shixun_work_report
|
|
|
|
|
@user = @work.user
|
|
|
|
|
@shixun = @homework.shixuns.take
|
|
|
|
|