|
|
|
@ -286,7 +286,7 @@ class HomeworksService
|
|
|
|
|
challenge_setting = challenge_settings.select{|setting| setting.challenge_id == game.challenge_id}.first
|
|
|
|
|
pass_consume_time += (game.cost_time / 60.0).to_f
|
|
|
|
|
user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i
|
|
|
|
|
adjust_score = work.challenge_work_scores.where(:challenge_id => game.challenge_id).last
|
|
|
|
|
adjust_score = work.challenge_work_scores.select{|work_score| work_score.challenge_id == game.challenge_id}.last
|
|
|
|
|
final_score += if adjust_score.present?
|
|
|
|
|
adjust_score.score
|
|
|
|
|
elsif homework.homework_detail_manual.answer_open_evaluation
|
|
|
|
@ -300,19 +300,6 @@ class HomeworksService
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
|
|
|
|
|
if myshixun_endtime.present?
|
|
|
|
|
work.cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i
|
|
|
|
|
|
|
|
|
|
efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0))
|
|
|
|
|
work.efficiency = format("%.2f", efficiency)
|
|
|
|
|
|
|
|
|
|
if myshixun_endtime <= homework_end_or_late_time
|
|
|
|
|
work.compelete_status = myshixun_endtime < setting_time.publish_time ? 2 : 1
|
|
|
|
|
|
|
|
|
|
# 如果作业的最大效率值有变更则更新所有作品的效率分
|
|
|
|
|
homework.update_column("max_efficiency", work.efficiency) if homework.work_efficiency && homework.max_efficiency < work.efficiency
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if work.work_status == 0
|
|
|
|
|
is_complete = myshixun_endtime && (myshixun_endtime < setting_time.end_time)
|
|
|
|
@ -321,18 +308,34 @@ class HomeworksService
|
|
|
|
|
elsif homework.allow_late && myshixun.created_at < homework.late_time
|
|
|
|
|
work.work_status = 2
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if work.work_status != 0
|
|
|
|
|
if myshixun_endtime.present?
|
|
|
|
|
work.cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i
|
|
|
|
|
|
|
|
|
|
efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0))
|
|
|
|
|
work.efficiency = format("%.2f", efficiency)
|
|
|
|
|
|
|
|
|
|
if myshixun_endtime <= homework_end_or_late_time
|
|
|
|
|
work.compelete_status = myshixun_endtime < setting_time.publish_time ? 2 : 1
|
|
|
|
|
|
|
|
|
|
# 如果作业的最大效率值有变更则更新所有作品的效率分
|
|
|
|
|
homework.update_column("max_efficiency", work.efficiency) if homework.work_efficiency && homework.max_efficiency < work.efficiency
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
work.late_penalty = work.work_status == 2 ? homework.late_penalty : 0
|
|
|
|
|
work.commit_time = myshixun.created_at > setting_time.publish_time ? setting_time.publish_time : myshixun.created_at
|
|
|
|
|
work.myshixun_id = myshixun.id
|
|
|
|
|
end
|
|
|
|
|
work.update_time = myshixun.updated_at
|
|
|
|
|
|
|
|
|
|
work.update_time = myshixun.updated_at
|
|
|
|
|
|
|
|
|
|
work.final_score = final_score
|
|
|
|
|
score = work.final_score + work.eff_score - work.late_penalty
|
|
|
|
|
work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) unless work.ultimate_score
|
|
|
|
|
#logger.info("#############work_score: #{score}")
|
|
|
|
|
work.calculation_time = Time.now
|
|
|
|
|
work.save!
|
|
|
|
|
work.final_score = final_score
|
|
|
|
|
score = work.final_score + work.eff_score - work.late_penalty
|
|
|
|
|
work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) unless work.ultimate_score
|
|
|
|
|
#logger.info("#############work_score: #{score}")
|
|
|
|
|
work.calculation_time = Time.now
|
|
|
|
|
work.save!
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|