|
|
|
@ -118,11 +118,11 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
# 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段
|
|
|
|
|
if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) &&
|
|
|
|
|
((!@homework.anonymous_comment && @homework.end_or_late) || @homework_detail_manual.comment_status > 4)
|
|
|
|
|
((!@homework.anonymous_comment && @homework.end_or_late) || (@homework_detail_manual.comment_status > 4 && @homework.end_or_late))
|
|
|
|
|
@student_works = student_works.where("user_id != #{@work.user_id}")
|
|
|
|
|
|
|
|
|
|
# 匿评、申诉阶段只能看到分配给自己的匿评作品
|
|
|
|
|
elsif @work&.work_status.to_i > 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 && @homework_detail_manual.comment_status <= 4
|
|
|
|
|
@is_evaluation = true
|
|
|
|
|
@student_works = student_works.joins(:student_works_evaluation_distributions).where(
|
|
|
|
|
"student_works_evaluation_distributions.user_id = #{@current_user.id}")
|
|
|
|
@ -240,7 +240,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update_score
|
|
|
|
|
tip_exception("作业还未发布,暂不能计算成绩") if @homework.end_or_late_none_group
|
|
|
|
|
tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now
|
|
|
|
|
begin
|
|
|
|
|
if @homework.unified_setting
|
|
|
|
|
student_works = @homework.student_works
|
|
|
|
@ -1354,7 +1354,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
if results.status == 0
|
|
|
|
|
code_info = results.code_info
|
|
|
|
|
homework_challenge_settings = @homework.homework_challenge_settings
|
|
|
|
|
@challenges = @shixun.challenges.where(id: homework_challenge_settings.pluck(:challenge_id), st: 0).includes(:games)
|
|
|
|
|
@challenges = @shixun.challenges.where(id: homework_challenge_settings.pluck(:challenge_id), st: 0)
|
|
|
|
|
@challenges =
|
|
|
|
|
@challenges.map do |challenge|
|
|
|
|
|
code_rate = 0
|
|
|
|
@ -1368,24 +1368,8 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
game = challenge.games.find_by(user_id: @user.id)
|
|
|
|
|
end_time = game.end_time
|
|
|
|
|
# 用户关卡的得分
|
|
|
|
|
all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score)
|
|
|
|
|
final_score =
|
|
|
|
|
if @student_work.challenge_work_scores.where(challenge_id: challenge.id).last.present?
|
|
|
|
|
@student_work.challenge_work_scores.where(:challenge_id => game.challenge_id).last.score
|
|
|
|
|
else
|
|
|
|
|
if game.status == 2 && ((game.end_time && game.end_time < @homework.end_time) ||
|
|
|
|
|
(@homework.allow_late && (@course.end_date.nil? ||
|
|
|
|
|
(game.end_time && game.end_time < @course.end_date.end_of_day))))
|
|
|
|
|
answer_open_evaluation = @homework.homework_detail_manual.answer_open_evaluation
|
|
|
|
|
# 设置了查看答案也获得满分的话就取总分。否则取关卡的百分比分支
|
|
|
|
|
if answer_open_evaluation.present?
|
|
|
|
|
all_score
|
|
|
|
|
else
|
|
|
|
|
# 关卡的百分比 * 作业设置的分数 = 总得分
|
|
|
|
|
((game.final_score) / challenge.score) * all_score
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f
|
|
|
|
|
final_score = @student_work.work_challenge_score game, all_score
|
|
|
|
|
# 抄袭用户
|
|
|
|
|
copy_user = User.find_by_id(game_codes[0].target_user_id)
|
|
|
|
|
copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present?
|
|
|
|
|