更改评分设置中的教师优先,评分未更新

This commit is contained in:
cxt 2016-05-03 15:12:56 +08:00
parent 8ccedaa622
commit c49627913b
2 changed files with 53 additions and 19 deletions

View File

@ -792,7 +792,7 @@ class StudentWorkController < ApplicationController
if homework_detail_manual.ta_proportion.to_s != params[:ta_proportion].to_s || @homework.teacher_priority.to_s != teacher_priority.to_s || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s)
homework_detail_manual.ta_proportion = params[:ta_proportion]
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
@homework.teacher_priority = teacher_priority
@homework.update_column('teacher_priority', teacher_priority)
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
@ -1175,8 +1175,12 @@ class StudentWorkController < ApplicationController
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
else #不考虑教师评分
if student_work.teaching_asistant_score.nil?
@ -1190,8 +1194,12 @@ class StudentWorkController < ApplicationController
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
if homework.teacher_priority == 1 #教师优先
@ -1226,8 +1234,12 @@ class StudentWorkController < ApplicationController
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
else #不考虑教师评分
if student_work.teaching_asistant_score.nil? #教辅未评分
@ -1257,8 +1269,12 @@ class StudentWorkController < ApplicationController
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
end
end

View File

@ -63,11 +63,17 @@ class StudentWork < ActiveRecord::Base
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
else #不考虑教师评分
if student_work.teaching_asistant_score.nil?
if student_work.student_score.nil? && student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.teacher_score
elsif student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.student_score
elsif student_work.student_score.nil?
student_work.final_score = student_work.teaching_asistant_score
@ -78,8 +84,12 @@ class StudentWork < ActiveRecord::Base
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
if homework.teacher_priority == 1 #教师优先
@ -114,9 +124,13 @@ class StudentWork < ActiveRecord::Base
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
else #不考虑教师评分
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
@ -145,8 +159,12 @@ class StudentWork < ActiveRecord::Base
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
end
end