实训作业的评分调整

This commit is contained in:
cxt 2017-09-11 15:48:02 +08:00
parent 4c7eb01bbf
commit 4adb8cbab6
3 changed files with 5 additions and 6 deletions

View File

@ -338,7 +338,6 @@ class HomeworkCommonController < ApplicationController
if @homework.end_time < Time.now
@homework.student_works.each do |student_work|
set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation
student_work.save
end
end
end

View File

@ -283,7 +283,7 @@ module ApplicationHelper
if myshixun.nil?
0
else
myshixun.games.select{|game| game.status == 2 && game.answer_open == 0}.count
myshixun.games.select{|game| game.status == 2 && !game.answer_open}.count
end
end
@ -5224,9 +5224,9 @@ def set_shixun_final_score homework, student_work, answer_open_evaluation
shixun = homework.homework_commons_shixuns.shixun
passed_count = answer_open_evaluation ? had_passed_changllenge_num(shixun, student_work.user) : had_passed_no_ans_changllenge_num(shixun, student_work.user)
final_score =(passed_count.to_f / shixun.challenges.count) * 100
student_work.final_score = format("%.2f",final_score.to_f)
student_work.update_column("final_score", format("%.2f",final_score.to_f))
score = student_work.final_score - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
student_work.update_column("work_score", format("%.2f",(score < 0 ? 0 : score).to_f)) if score
end
end

View File

@ -86,10 +86,10 @@ namespace :homework_publishtime do
homework.student_works.where("work_status != 0").each do |student_work|
passed_count = homework.homework_detail_manual.answer_open_evaluation ? had_passed_changllenge_num_rake(student_work.myshixun) : had_passed_no_ans_changllenge_num_rake(student_work.myshixun)
final_score =(passed_count.to_f / shixun.challenges.count) * 100
student_work.final_score = format("%.2f",final_score.to_f)
student_work.update_column("final_score", format("%.2f",final_score.to_f))
score = student_work.final_score - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
student_work.save
student_work.update_column("work_score", format("%.2f",(score < 0 ? 0 : score).to_f))
end
end
end