|
|
@ -1459,7 +1459,8 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
if game_codes.count > 0
|
|
|
|
if game_codes.count > 0
|
|
|
|
code_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length
|
|
|
|
code_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length
|
|
|
|
end
|
|
|
|
end
|
|
|
|
target = game_codes.count > 0 ? game_codes[0].target_user_id : nil
|
|
|
|
logger.info("#####game_codes: #{game_codes}")
|
|
|
|
|
|
|
|
#target = game_codes.count > 0 ? game_codes[0].target_user_id : nil
|
|
|
|
# 作品完成时间
|
|
|
|
# 作品完成时间
|
|
|
|
game = challenge.games.find_by(user_id: @user.id)
|
|
|
|
game = challenge.games.find_by(user_id: @user.id)
|
|
|
|
end_time = game.end_time
|
|
|
|
end_time = game.end_time
|
|
|
@ -1467,7 +1468,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f
|
|
|
|
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
|
|
|
|
final_score = @student_work.work_challenge_score game, all_score
|
|
|
|
# 抄袭用户
|
|
|
|
# 抄袭用户
|
|
|
|
copy_user = User.find_by_id(game_codes[0].target_user_id)
|
|
|
|
copy_user = User.find_by_id(game_codes[0].try(:target_user_id))
|
|
|
|
copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present?
|
|
|
|
copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present?
|
|
|
|
# 代码部分
|
|
|
|
# 代码部分
|
|
|
|
code_list = []
|
|
|
|
code_list = []
|
|
|
@ -1477,7 +1478,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content}
|
|
|
|
code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。
|
|
|
|
{code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score,
|
|
|
|
{code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score,
|
|
|
|
all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name),
|
|
|
|
all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name),
|
|
|
|
username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position,
|
|
|
|
username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position,
|
|
|
|