评分设置:提供两种机制由用户选择

This commit is contained in:
cxt 2017-04-25 17:13:33 +08:00
parent 35a60d5c31
commit 552b571762
11 changed files with 558 additions and 338 deletions

View File

@ -1225,19 +1225,36 @@ class StudentWorkController < ApplicationController
end
end
if (params[:te_proportion] && params[:te_proportion].to_s != homework_detail_manual.te_proportion.to_s) || (params[:ta_proportion] && params[:ta_proportion].to_s != homework_detail_manual.ta_proportion.to_s) || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s)
homework_detail_manual.te_proportion = params[:te_proportion]
homework_detail_manual.ta_proportion = params[:ta_proportion]
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
if params[:final_mode] && params[:final_mode].to_i != homework_detail_manual.final_mode
homework_detail_manual.final_mode = params[:final_mode].to_i
if params[:final_mode].to_i == 0
homework_detail_manual.te_proportion = params[:te_proportion]
homework_detail_manual.ta_proportion = params[:ta_proportion]
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
homework_detail_programing.save if homework_detail_programing
end
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
@homework.save
@homework = HomeworkCommon.find @homework.id
@homework.student_works.each do |student_work|
set_final_score @homework,student_work
student_work.save
end
elsif params[:final_mode] && homework_detail_manual.final_mode == 0
if (params[:te_proportion] && params[:te_proportion].to_s != homework_detail_manual.te_proportion.to_s) || (params[:ta_proportion] && params[:ta_proportion].to_s != homework_detail_manual.ta_proportion.to_s) || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s)
homework_detail_manual.te_proportion = params[:te_proportion]
homework_detail_manual.ta_proportion = params[:ta_proportion]
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
@homework.save
@homework = HomeworkCommon.find @homework.id
@homework.student_works.each do |student_work|
set_final_score @homework,student_work
student_work.save
end
end
end
@homework.save
@ -1815,120 +1832,148 @@ class StudentWorkController < ApplicationController
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual
tea_ass_proportion = homework.homework_detail_manual.ta_proportion
tea_proportion = homework.homework_detail_manual.te_proportion
if homework.homework_type != 2 #非编程作业
if student_work.teacher_score
if student_work.teaching_asistant_score.nil?
if student_work.student_score.nil?
student_work.final_score = student_work.teacher_score
if !homework.homework_detail_manual.final_mode
tea_ass_proportion = homework.homework_detail_manual.ta_proportion
tea_proportion = homework.homework_detail_manual.te_proportion
if homework.homework_type != 2 #非编程作业
if student_work.teacher_score
if student_work.teaching_asistant_score.nil?
if student_work.student_score.nil?
student_work.final_score = student_work.teacher_score
else
te_proportion = tea_proportion + tea_ass_proportion / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
te_proportion = tea_proportion + tea_ass_proportion / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
if student_work.student_score.nil?
te_proportion = tea_proportion + (1.0 - tea_proportion - tea_ass_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
else
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_te_score + final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
else
if student_work.student_score.nil?
te_proportion = tea_proportion + (1.0 - tea_proportion - tea_ass_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
if 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
else
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_te_score + final_ta_score + final_s_score
ta_proportion = tea_ass_proportion + tea_proportion / 2
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
else
if 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
else
ta_proportion = tea_ass_proportion + tea_proportion / 2
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
#if homework.teacher_priority == 1 #教师优先
sy_proportion = homework.homework_detail_programing.ta_proportion
if student_work.teacher_score
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
ta_proportion = tea_proportion + (1 - tea_proportion - sy_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{ta_proportion}")
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_te_score
student_work.final_score = format("%.2f",final_score.to_f)
else
rest_proportion = tea_ass_proportion / 3
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
#if homework.teacher_priority == 1 #教师优先
sy_proportion = homework.homework_detail_programing.ta_proportion
if student_work.teacher_score
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
ta_proportion = tea_proportion + (1 - tea_proportion - sy_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{ta_proportion}")
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_te_score
student_work.final_score = format("%.2f",final_score.to_f)
else
rest_proportion = tea_ass_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
rest_proportion = (1 - tea_proportion - sy_proportion - tea_ass_proportion) / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_st_score
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
rest_proportion = (1 - tea_proportion - sy_proportion - tea_ass_proportion) / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion}") - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_sy_score + final_ta_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = sy_proportion + (tea_ass_proportion + tea_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = sy_proportion + (1.0 - tea_ass_proportion - sy_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_ts_score
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion}") - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_sy_score + final_ta_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
rest_proportion = tea_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_ass_proportion + rest_proportion}"))
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = sy_proportion + (tea_ass_proportion + tea_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = sy_proportion + (1.0 - tea_ass_proportion - sy_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_ts_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
rest_proportion = tea_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_ass_proportion + rest_proportion}"))
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
end
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
if homework.homework_type != 2
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
else
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.student_score
else
student_work.final_score = student_work.teaching_asistant_score
end
end
elsif homework.homework_type == 2 && homework.homework_detail_programing
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
else
if student_work.teaching_asistant_score
student_work.final_score = student_work.teaching_asistant_score
else
if student_work.system_score
student_work.final_score = student_work.system_score
else
student_work.final_score = student_work.student_score
end
end
end
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_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
end

View File

@ -1,7 +1,7 @@
#手动评分作业表
#comment_status: 1:未开启匿评2开启匿评3匿评结束
class HomeworkDetailManual < ActiveRecord::Base
attr_accessible :te_proportion, :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty
attr_accessible :te_proportion, :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty, :ta_mode, :final_mode
belongs_to :homework_common
end

View File

@ -50,119 +50,153 @@ class StudentWork < ActiveRecord::Base
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual
tea_ass_proportion = homework.homework_detail_manual.ta_proportion
tea_proportion = homework.homework_detail_manual.te_proportion
if homework.homework_type != 2 #非编程作业
if student_work.teacher_score
if student_work.teaching_asistant_score.nil?
if student_work.student_score.nil?
student_work.final_score = student_work.teacher_score
if !homework.homework_detail_manual.final_mode
tea_ass_proportion = homework.homework_detail_manual.ta_proportion
tea_proportion = homework.homework_detail_manual.te_proportion
if homework.homework_type != 2 #非编程作业
if student_work.teacher_score
if student_work.teaching_asistant_score.nil?
if student_work.student_score.nil?
student_work.final_score = student_work.teacher_score
else
te_proportion = tea_proportion + tea_ass_proportion / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
te_proportion = tea_proportion + tea_ass_proportion / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
if student_work.student_score.nil?
te_proportion = tea_proportion + (1.0 - tea_proportion - tea_ass_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
else
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_te_score + final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
else
if student_work.student_score.nil?
te_proportion = tea_proportion + (1.0 - tea_proportion - tea_ass_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
if 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
else
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_te_score + final_ta_score + final_s_score
ta_proportion = tea_ass_proportion + tea_proportion / 2
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
else
if 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
else
ta_proportion = tea_ass_proportion + tea_proportion / 2
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
#if homework.teacher_priority == 1 #教师优先
sy_proportion = homework.homework_detail_programing.ta_proportion
if student_work.teacher_score
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
ta_proportion = tea_proportion + (1 - tea_proportion - sy_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{ta_proportion}")
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_te_score
student_work.final_score = format("%.2f",final_score.to_f)
else
rest_proportion = tea_ass_proportion / 3
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
#if homework.teacher_priority == 1 #教师优先
sy_proportion = homework.homework_detail_programing.ta_proportion
if student_work.teacher_score
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
ta_proportion = tea_proportion + (1 - tea_proportion - sy_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{ta_proportion}")
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_te_score
student_work.final_score = format("%.2f",final_score.to_f)
else
rest_proportion = tea_ass_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
rest_proportion = (1 - tea_proportion - sy_proportion - tea_ass_proportion) / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_st_score
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
rest_proportion = (1 - tea_proportion - sy_proportion - tea_ass_proportion) / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion}") - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_sy_score + final_ta_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = sy_proportion + (tea_ass_proportion + tea_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = sy_proportion + (1.0 - tea_ass_proportion - sy_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_ts_score
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion}") - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_sy_score + final_ta_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
rest_proportion = tea_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_ass_proportion + rest_proportion}"))
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = sy_proportion + (tea_ass_proportion + tea_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = sy_proportion + (1.0 - tea_ass_proportion - sy_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_ts_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
rest_proportion = tea_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_ass_proportion + rest_proportion}"))
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
end
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
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.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
else
student_work.work_score = nil
if homework.homework_type != 2
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
else
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.student_score
else
student_work.final_score = student_work.teaching_asistant_score
end
end
elsif homework.homework_type == 2 && homework.homework_detail_programing
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
else
if student_work.teaching_asistant_score
student_work.final_score = student_work.teaching_asistant_score
else
if student_work.system_score
student_work.final_score = student_work.system_score
else
student_work.final_score = student_work.student_score
end
end
end
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_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

@ -101,30 +101,59 @@
<div class="cl"></div>
<span class="separator_long"></span>
<li class="mb10 mt10 fl">
<li class="fl mt10">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<ul class="fl ml5">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">学生匿评</span>
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= 100 - (homework.homework_detail_manual.te_proportion * 100).to_i - (homework.homework_detail_manual.ta_proportion * 100).to_i%>%" class="fl ml15" readonly>
<ul class="fl">
<li class="fl">
<input type="radio" class="fl" id="final_mode" value="0" name="final_mode"/>
<label for="final_mode" class="fl ml5">多项评分配比</label>
</li>
<div class="cl"></div>
<ul class="fl ml18">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">学生匿评</span>
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= 100 - (homework.homework_detail_manual.te_proportion * 100).to_i - (homework.homework_detail_manual.ta_proportion * 100).to_i%>%" class="fl ml15" readonly>
</li>
</ul>
</ul>
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 78px;">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 65px;">
<em></em>
<span></span>
<p>教师评分 * 其百分比+ <br/>
助教评分 * 其百分比+ <br/>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 + <br/>
学生匿评平均分 * 其百分比 - <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
( 迟交扣分+缺评扣分+违规匿评扣分 ) <br/>
注意:非零百分比的评分选项,在没有评分 <br/>记录的情况下,其百分比平摊到另外的非零 <br/>评分选项上
</p>
</div>
<ul class="fl mb10">
<li class="fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="1" id="no_final_mode" name="final_mode"/><label for="no_final_mode" class="fl ml5">单项评分优先</label>
</li>
<div class="cl"></div>
<li class="fl ml18">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>教师 --> 助教 --> 匿评
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 64px;">
<em></em>
<span></span>
<p>优先顺序排前的非零评分 * 100% - <br/>
(迟交扣分+缺评扣分+违规匿评扣分) <br/>
有教师评分则教师评分100%,否则 <br/>
助教评分100%,依次类推
</p>
</div>
</ul>
<div class="cl"></div>
@ -148,32 +177,33 @@
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#student_proportion").val(ta_proportion + "%");
});
<% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked");
<% else %>
$("#other_score").attr("checked", "checked");
<% end %>
<% if homework.homework_detail_manual.ta_mode == 1 %>
$("#ta_normal_mode").attr("checked", "checked");
<% else %>
$("#ta_re_mode").attr("checked", "checked");
<% end %>
$("#teacher_score").change(function(){
if($("#teacher_score").attr("checked")){
$("#late_penalty_num").val("0");
$("#absence_penalty_num").val("0");
<% if homework.homework_detail_manual.final_mode %>
$("#no_final_mode").attr("checked", "checked");
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
<% else %>
$("#final_mode").attr("checked", "checked");
<% end %>
$("#final_mode").click(function(){
if($("#final_mode").attr("checked")){
$("#te_proportion").removeAttr("disabled");
$("#ta_proportion").removeAttr("disabled");
}
});
$("#other_score").change(function(){
if($("#other_score").attr("checked")){
$("#late_penalty_num").val("10");
<% if homework.homework_detail_manual && homework.homework_detail_manual.evaluation_num == -1 %>
$("#absence_penalty_num").val("0");
<% else %>
$("#absence_penalty_num").val("5");
<% end %>
$("#no_final_mode").click(function(){
if($("#no_final_mode").attr("checked")){
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
}
});
<% if homework.anonymous_appeal == 1 %>
$("#anonymous_appeal").attr("checked", "checked");
<% else %>

View File

@ -1,4 +1,4 @@
<div id="muban_popup_box" style="width:530px;">
<div id="muban_popup_box" style="width:560px;">
<div class="muban_popup_top">
<h3 class="fl">评分设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
@ -12,7 +12,7 @@
<label class="pop_box_label fl">迟交扣分&nbsp;&nbsp;:&nbsp;</label>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="0-50" class="fl issues_calendar_input" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 w190">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 w230">
<em></em>
<span></span>
<p >请输入数值0-50</p>
@ -24,7 +24,7 @@
<input type="radio" class="fl" value="1" id="ta_normal_mode" name="ta_mode"/>
<label for="ta_normal_mode" class=" fl ml5">普通模式</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 = 各助教最新评分的平均分</p>
@ -34,36 +34,67 @@
<input type="radio" class="fl" id="ta_re_mode" value="2" name="ta_mode"/>
<label for="ta_re_mode" class="fl ml5">复审模式</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 = 最新的助教评分</p>
</div>
<div class="cl"></div>
<span class="separator_short"></span>
<li class="mb10 fl">
<li class="fl mt10">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<!--<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/>-->
<ul class="fl ml5">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<input type="hidden" name="ta_proportion" value="<%= homework.homework_detail_manual.ta_proportion %>">
<input type="text" style="width: 49px; padding-left: 10px;" id="ta_proportion" value="<%= (homework.homework_detail_manual.ta_proportion * 100).to_i %>%" class="fl ml15" readonly>
<ul class="fl">
<li class="fl">
<input type="radio" class="fl" id="final_mode" value="0" name="final_mode"/>
<label for="final_mode" class="fl ml5">多项评分配比</label>
</li>
<div class="cl"></div>
<ul class="fl ml18">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<input type="hidden" name="ta_proportion" value="<%= homework.homework_detail_manual.ta_proportion %>">
<input type="text" style="width: 49px; padding-left: 10px;" id="ta_proportion" value="<%= (homework.homework_detail_manual.ta_proportion * 100).to_i %>%" class="fl ml15" readonly>
</li>
</ul>
</ul>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 29px;">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 16px;">
<em></em>
<span></span>
<p >教师评分 * 其百分比 + <br/>助教评分 * 其百分比 - <br/> 迟交扣分 </p>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 - <br/>
迟交扣分 <br/>
注意:非零百分比的评分选项,在没有评分 <br/>记录的情况下,其百分比平摊到另外的非零 <br/>评分选项上
</p>
</div>
<ul class="fl mb10">
<li class="fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="1" id="no_final_mode" name="final_mode"/><label for="no_final_mode" class="fl ml5">单项评分优先</label>
</li>
<div class="cl"></div>
<li class="fl ml18">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>教师 --> 助教
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 66px;">
<em></em>
<span></span>
<p>优先顺序排前的非零评分 * 100% - <br/>
迟交扣分 <br/>
有教师评分则教师评分100%,否则 <br/>
助教评分100%,依次类推
</p>
</div>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr40" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_blue mr30" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div>
</div>
@ -80,24 +111,28 @@
$("input[name='ta_proportion']").val(ta_proportion/100);
});
<% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked");
<% else %>
$("#other_score").attr("checked", "checked");
<% end %>
<% if homework.homework_detail_manual.ta_mode == 1 %>
$("#ta_normal_mode").attr("checked", "checked");
<% else %>
$("#ta_re_mode").attr("checked", "checked");
<% end %>
$("#teacher_score").change(function(){
if($("#teacher_score").attr("checked")){
$("#late_penalty_num").val("0");
<% if homework.homework_detail_manual.final_mode %>
$("#no_final_mode").attr("checked", "checked");
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
<% else %>
$("#final_mode").attr("checked", "checked");
<% end %>
$("#final_mode").click(function(){
if($("#final_mode").attr("checked")){
$("#te_proportion").removeAttr("disabled");
$("#ta_proportion").removeAttr("disabled");
}
});
$("#other_score").change(function(){
if($("#other_score").attr("checked")){
$("#late_penalty_num").val("10");
$("#no_final_mode").click(function(){
if($("#no_final_mode").attr("checked")){
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
}
});
});

View File

@ -101,42 +101,70 @@
<div class="cl"></div>
<span class="separator_long"></span>
<li class="mb10 mt10 fl">
<li class="fl mt10">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<ul class="fl ml5">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">系统评分</span>
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i-(homework.homework_detail_manual.ta_proportion * 100).to_i),homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">学生匿评</span>
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= 100 - (homework.homework_detail_manual.te_proportion * 100).to_i - (homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing.ta_proportion * 100).to_i%>%" class="fl ml15" readonly>
<ul class="fl">
<li class="fl">
<input type="radio" class="fl" id="final_mode" value="0" name="final_mode"/>
<label for="final_mode" class="fl ml5">多项评分配比</label>
</li>
<div class="cl"></div>
<ul class="fl ml18">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">系统评分</span>
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i-(homework.homework_detail_manual.ta_proportion * 100).to_i),homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">学生匿评</span>
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= 100 - (homework.homework_detail_manual.te_proportion * 100).to_i - (homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing.ta_proportion * 100).to_i%>%" class="fl ml15" readonly>
</li>
</ul>
</ul>
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 73px;">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 65px;">
<em></em>
<span></span>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 + <br/>
系统评分 * 其百分比 + <br/>
学生匿评平均分 * 其百分比 - <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
( 迟交扣分+缺评扣分+违规匿评扣分 ) <br/>
注意:非零百分比的评分选项,在没有评分 <br/>记录的情况下,其百分比平摊到另外的非零 <br/>评分选项上
</p>
</div>
<ul class="fl mb10">
<li class="fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="1" id="no_final_mode" name="final_mode"/><label for="no_final_mode" class="fl ml5">单项评分优先</label>
</li>
<div class="cl"></div>
<li class="fl ml18">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>教师 --> 助教 --> 系统 --> 匿评
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 14px;">
<em></em>
<span></span>
<p>优先顺序排前的非零评分 * 100% - <br/>
(迟交扣分+缺评扣分+违规匿评扣分) <br/>
有教师评分则教师评分100%,否则 <br/>
助教评分100%,依次类推
</p>
</div>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr50" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div>
</div>
<% end%>
</div>
@ -161,32 +189,35 @@
var sy_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100) - parseInt(parseFloat($("#sy_proportion").val()) * 100);
$("#student_proportion").val(sy_proportion + "%");
});
<% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked");
<% else %>
$("#other_score").attr("checked", "checked");
<% end %>
<% if homework.homework_detail_manual.ta_mode == 1 %>
$("#ta_normal_mode").attr("checked", "checked");
<% else %>
$("#ta_re_mode").attr("checked", "checked");
<% end %>
$("#teacher_score").change(function(){
if($("#teacher_score").attr("checked")){
$("#late_penalty_num").val("0");
$("#absence_penalty_num").val("0");
<% if homework.homework_detail_manual.final_mode %>
$("#no_final_mode").attr("checked", "checked");
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
$("#sy_proportion").attr("disabled", "disabled");
<% else %>
$("#final_mode").attr("checked", "checked");
<% end %>
$("#final_mode").click(function(){
if($("#final_mode").attr("checked")){
$("#te_proportion").removeAttr("disabled");
$("#ta_proportion").removeAttr("disabled");
$("#sy_proportion").removeAttr("disabled");
}
});
$("#other_score").change(function(){
if($("#other_score").attr("checked")){
$("#late_penalty_num").val("10");
<% if homework.homework_detail_manual && homework.homework_detail_manual.evaluation_num == -1 %>
$("#absence_penalty_num").val("0");
<% else %>
$("#absence_penalty_num").val("5");
<% end %>
$("#no_final_mode").click(function(){
if($("#no_final_mode").attr("checked")){
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
$("#sy_proportion").attr("disabled", "disabled");
}
});
<% if homework.anonymous_appeal == 1 %>
$("#anonymous_appeal").attr("checked", "checked");
<% else %>

View File

@ -1,4 +1,4 @@
<div id="muban_popup_box" style="width:530px;">
<div id="muban_popup_box" style="width:560px;">
<div class="muban_popup_top">
<h3 class="fl">评分设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
@ -12,7 +12,7 @@
<label class="pop_box_label fl">迟交扣分&nbsp;&nbsp;:&nbsp;</label>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="0-50" class="fl issues_calendar_input" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 w190">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 w230">
<em></em>
<span></span>
<p >请输入数值0-50</p>
@ -24,7 +24,7 @@
<input type="radio" class="fl" value="1" id="ta_normal_mode" name="ta_mode"/>
<label for="ta_normal_mode" class=" fl ml5">普通模式</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 = 各助教最新评分的平均分</p>
@ -34,40 +34,72 @@
<input type="radio" class="fl" id="ta_re_mode" value="2" name="ta_mode"/>
<label for="ta_re_mode" class="fl ml5">复审模式</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 = 最新的助教评分</p>
</div>
<div class="cl"></div>
<span class="separator_short"></span>
<li class="mb10 fl">
<li class="fl mt10">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<!--<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/>-->
<ul class="fl ml5">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">系统评分</span>
<input name="sy_proportion" type="hidden" value="<%= homework.homework_detail_programing.ta_proportion %>">
<input type="text" style="width: 49px; padding-left: 10px;" id="sy_proportion" value="<%= (homework.homework_detail_programing.ta_proportion * 100).to_i %>%" class="fl ml15" readonly>
<ul class="fl">
<li class="fl">
<input type="radio" class="fl" id="final_mode" value="0" name="final_mode"/>
<label for="final_mode" class="fl ml5">多项评分配比</label>
</li>
<div class="cl"></div>
<ul class="fl ml18">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">系统评分</span>
<input name="sy_proportion" type="hidden" value="<%= homework.homework_detail_programing.ta_proportion %>">
<input type="text" style="width: 49px; padding-left: 10px;" id="sy_proportion" value="<%= (homework.homework_detail_programing.ta_proportion * 100).to_i %>%" class="fl ml15" readonly>
</li>
</ul>
</ul>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 29px;">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 16px;">
<em></em>
<span></span>
<p >教师评分 * 其百分比 + <br/>助教评分 * 其百分比 + <br/>系统评分 * 其百分比 - <br/> 迟交扣分 </p>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 + <br/>
系统评分 * 其百分比 - <br/>
迟交扣分 <br/>
注意:非零百分比的评分选项,在没有评分 <br/>记录的情况下,其百分比平摊到另外的非零 <br/>评分选项上
</p>
</div>
<ul class="fl mb10">
<li class="fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="1" id="no_final_mode" name="final_mode"/><label for="no_final_mode" class="fl ml5">单项评分优先</label>
</li>
<div class="cl"></div>
<li class="fl ml18">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>教师 --> 助教 --> 系统
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 16px;">
<em></em>
<span></span>
<p>优先顺序排前的非零评分 * 100% - <br/>
迟交扣分 <br/>
有教师评分则教师评分100%,否则 <br/>
助教评分100%,依次类推
</p>
</div>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr40" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_blue mr30" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div>
@ -91,24 +123,29 @@
$("#sy_proportion").val(ta_proportion + "%");
$("input[name='sy_proportion']").val(ta_proportion/100);
});
<% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked");
<% else %>
$("#other_score").attr("checked", "checked");
<% end %>
<% if homework.homework_detail_manual.ta_mode == 1 %>
$("#ta_normal_mode").attr("checked", "checked");
<% else %>
$("#ta_re_mode").attr("checked", "checked");
<% end %>
$("#teacher_score").change(function(){
if($("#teacher_score").attr("checked")){
$("#late_penalty_num").val("0");
<% if homework.homework_detail_manual.final_mode %>
$("#no_final_mode").attr("checked", "checked");
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
<% else %>
$("#final_mode").attr("checked", "checked");
<% end %>
$("#final_mode").click(function(){
if($("#final_mode").attr("checked")){
$("#te_proportion").removeAttr("disabled");
$("#ta_proportion").removeAttr("disabled");
}
});
$("#other_score").change(function(){
if($("#other_score").attr("checked")){
$("#late_penalty_num").val("10");
$("#no_final_mode").click(function(){
if($("#no_final_mode").attr("checked")){
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
}
});
});

View File

@ -4,7 +4,7 @@
pop_box_new(htmlvalue, 630, 500);
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
pop_box_new(htmlvalue, 530, 404);
pop_box_new(htmlvalue, 560, 522);
<% end %>
<% else %>
<% if @homework.anonymous_comment == 0 %>
@ -12,7 +12,7 @@
pop_box_new(htmlvalue, 630, 500);
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
pop_box_new(htmlvalue, 530, 332);
pop_box_new(htmlvalue, 560, 507);
<% end %>
<% end %>
function set_score_rule_submit() {

View File

@ -0,0 +1,5 @@
class AddFinalModeToHomeworkDetailManuals < ActiveRecord::Migration
def change
add_column :homework_detail_manuals, :final_mode, :boolean, :default => 0
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20170418065031) do
ActiveRecord::Schema.define(:version => 20170425030242) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -290,6 +290,7 @@ ActiveRecord::Schema.define(:version => 20170418065031) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "root_id"
t.integer "visits", :default => 0
end
add_index "blog_comments", ["root_id"], :name => "index_blog_comments_on_root_id"
@ -1270,12 +1271,13 @@ ActiveRecord::Schema.define(:version => 20170418065031) do
t.integer "evaluation_num"
t.integer "absence_penalty", :default => 1
t.integer "homework_common_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "no_anon_penalty", :default => 1
t.integer "appeal_penalty", :default => 0
t.integer "ta_mode", :default => 1
t.float "te_proportion", :default => 1.0
t.boolean "final_mode", :default => false
end
create_table "homework_detail_programings", :force => true do |t|
@ -2734,6 +2736,7 @@ ActiveRecord::Schema.define(:version => 20170418065031) do
t.integer "excellent_teacher", :default => 0
t.integer "excellent_student", :default => 0
t.string "phone"
t.boolean "authentication", :default => false
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"

View File

@ -86,7 +86,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.markPercentage {margin:10px 0; border:1px solid #e6e6e6; width:70px; height:30px; outline:none; font-size:12px; color:#3d3c3c;}
/* Spacing */
.ml2{ margin-left:2px;}.ml3{ margin-left:3px;}.ml4{ margin-left:4px;}.ml5{ margin-left:5px;}.ml7 {margin-left:7px;}.ml8{ margin-left:8px;}.ml9{ margin-left:9px;}
.ml10{ margin-left:10px;}.ml14{ margin-left:14px;}.ml15{ margin-left:15px;}.ml16{ margin-left:16px;}.ml20{ margin-left:20px;}.ml21{ margin-left:21px;}
.ml10{ margin-left:10px;}.ml14{ margin-left:14px;}.ml15{ margin-left:15px;}.ml16{ margin-left:16px;}.ml18{ margin-left:18px;}.ml20{ margin-left:20px;}.ml21{ margin-left:21px;}
.ml24{margin-left:24px;}.ml25{margin-left:25px;}.ml30{margin-left:30px !important;}.ml35{margin-left: 35px;}.ml36{ margin-left:36px; }.ml38{ margin-left:38px;}
.ml39{ margin-left:39px;}.ml40{ margin-left:40px;}.ml41{ margin-left:41px;}.ml42{ margin-left:42px;}.ml45{ margin-left:45px;}.ml48{ margin-left:48px;}.ml50{ margin-left: 50px;}
.ml53{margin-left:53px;}.ml55{ margin-left:55px;}.ml56{ margin-left:56px !important;}.ml58{margin-left:58px;}.ml60{ margin-left:60px;}.ml65{ margin-left:65px;}
@ -424,7 +424,7 @@ a.export_icon:hover {background: url(/images/item.png) -58px -60px no-repeat;}
.icons-user-homework{background:url(/images/user/home-user-left.png) 0px -150px no-repeat; }
.homework-user-leftnav-li{ height: 25px; line-height: 40px; padding-left: 25px; color: #666;background:url(/images/user/home-user-left.png) 0px -149px no-repeat; font-size: 14px; position: relative; }
.homework-user-leftnav-li:hover{ height: 25px; line-height: 40px; padding-left: 25px; background:#f4f4f4; background:url(/images/user/home-user-left.png) 0px -186px no-repeat; font-size: 14px; position: relative; }
.separator_short{margin-top: 5px; margin-bottom: 5px; margin-left: 37px; width: 433px; display: block; border-bottom: 1px solid #d9d9d9;}
.separator_short{margin-top: 5px; margin-bottom: 5px; margin-left: 37px; width: 473px; display: block; border-bottom: 1px solid #d9d9d9;}
.separator_long{margin-top: 5px; margin-bottom: 5px; margin-left: 37px; width: 522px; display: block; border-bottom: 1px solid #d9d9d9;}
/* 模板弹框 20161013byLB */
#muban_popup_box{ background:#fff;padding-bottom:15px;-webkit-border-radius:5px;-moz-border-radius:5px;-o-border-radius:5px;border-radius:5px;box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);}