Merge branch 'develop' into 'develop'

本周上线任务



See merge request !179
This commit is contained in:
陈晓婷 2017-04-01 09:34:06 +08:00
commit 58b8c01371
16 changed files with 359 additions and 338 deletions

View File

@ -176,11 +176,8 @@ class HomeworkCommonController < ApplicationController
end end
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1 anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
if anonymous != @homework.anonymous_comment if anonymous != @homework.anonymous_comment
if anonymous == 1 homework_detail_manual.te_proportion = 1.0
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0 homework_detail_manual.ta_proportion = 0
else
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
end
end end
@homework.save_attachments(params[:attachments]) @homework.save_attachments(params[:attachments])
@ -192,11 +189,7 @@ class HomeworkCommonController < ApplicationController
@homework_detail_programing = @homework.homework_detail_programing @homework_detail_programing = @homework.homework_detail_programing
@homework_detail_programing.language = params[:language_type].to_i if params[:language_type] @homework_detail_programing.language = params[:language_type].to_i if params[:language_type]
if anonymous != @homework.anonymous_comment if anonymous != @homework.anonymous_comment
if anonymous == 1 @homework_detail_programing.ta_proportion = 0
@homework_detail_programing.ta_proportion = 0.6
else
@homework_detail_programing.ta_proportion = 0.5
end
end end
@homework.homework_samples.delete_all if params[:sample] @homework.homework_samples.delete_all if params[:sample]
@ -267,36 +260,6 @@ class HomeworkCommonController < ApplicationController
def destroy def destroy
if @homework.destroy if @homework.destroy
#更新CourseHomeworkStatistics中每个学生的未交作品数、已交作品数、迟交作品数
hw_count = @course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
homework_ids = @course.homework_commons.empty? ? "(-1)" : "(" + @course.homework_commons.map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and work_status !=0")
is_eva_homeworks = @course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 2")
is_eva_student_works = StudentWork.where(:homework_common_id => is_eva_homeworks.map{|hw| hw.id})
has_eva_homeworks = @course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 3")
has_eva_student_works = StudentWork.where(:homework_common_id => has_eva_homeworks.map{|hw| hw.id})
@course.student.each do |student|
user = student.student
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, student.student_id)
if user && course_statistics
committed_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status != 0").count
un_commit_work_num = (hw_count - committed_work_num) < 0 ? 0 : (hw_count - committed_work_num)
late_commit_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status = 2").count
absence_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => has_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => has_eva_student_works.map(&:id)).group_by(&:student_work_id).count
absence_evaluation_work_num = absence_evaluation_work_num < 0 ? 0 : absence_evaluation_work_num
un_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => is_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => is_eva_student_works.map(&:id)).group_by(&:student_work_id).count
un_evaluation_work_num = un_evaluation_work_num < 0 ? 0 : un_evaluation_work_num
appeal_num = user.student_works_scores.where(:student_work_id => student_works.map(&:id), :appeal_status => 3).count
average_score = user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first.score : 0
total_score = user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
course_statistics.update_attributes(:committed_work_num => committed_work_num, :un_commit_work_num => un_commit_work_num,
:late_commit_work_num => late_commit_work_num, :absence_evaluation_work_num => absence_evaluation_work_num, :un_evaluation_work_num => un_evaluation_work_num,
:appeal_num => appeal_num, :average_score => average_score, :total_score => total_score)
end
end
respond_to do |format| respond_to do |format|
format.html { format.html {
@hw_status = params[:hw_status].to_i @hw_status = params[:hw_status].to_i
@ -315,17 +278,20 @@ class HomeworkCommonController < ApplicationController
#加入到题库 #加入到题库
def add_to_homework_bank def add_to_homework_bank
if params[:type] && (params[:type].to_i == 1 || params[:type].to_i == 3) if params[:type] && (params[:type].to_i == 1 || params[:type].to_i == 3)
if params[:type].to_i == 3
old_banks = HomeworkBank.where(:homework_common_id => @homework.id)
unless old_banks.blank?
old_banks.each do |bank|
bank.update_attributes(:quotes => (bank.quotes - 1) > 0 ? (bank.quotes - 1) : 0)
end
end
end
homework_bank = add_to_homework_bank_f @homework homework_bank = add_to_homework_bank_f @homework
homework_bank.save homework_bank.save
@homework.update_attributes(:homework_bank_id => homework_bank.id) # 如果是另存到题库且是作业创建者,则将原题库的引用数减一
if params[:type].to_i == 3 && User.current == @homework.user
old_banks = HomeworkBank.where(:id => @homework.homework_bank_id)
unless old_banks.blank?
old_banks.first.update_attributes(:quotes => (old_banks.first.quotes - 1) > 0 ? (old_banks.first.quotes - 1) : 0)
end
end
if User.current == @homework.user
@homework.update_attributes(:homework_bank_id => homework_bank.id)
else
homework_bank.update_column('quotes', 0);
end
elsif params[:type].to_i == 2 elsif params[:type].to_i == 2
homework_bank = HomeworkBank.where(:id => @homework.homework_bank_id).first homework_bank = HomeworkBank.where(:id => @homework.homework_bank_id).first
if homework_bank if homework_bank
@ -352,7 +318,7 @@ class HomeworkCommonController < ApplicationController
end end
end end
end end
if @homework.is_update if @homework.is_update && User.current == @homework.user
@homework.update_attributes(:is_update => 0) @homework.update_attributes(:is_update => 0)
end end
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i

View File

@ -1225,15 +1225,13 @@ class StudentWorkController < ApplicationController
end end
end end
teacher_priority = params[:teacher_priority].to_i 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)
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.te_proportion = params[:te_proportion]
homework_detail_manual.ta_proportion = params[:ta_proportion] homework_detail_manual.ta_proportion = params[:ta_proportion]
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
@homework.update_column('teacher_priority', teacher_priority)
homework_detail_manual.save if homework_detail_manual homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing homework_detail_programing.save if homework_detail_programing
@homework.save @homework.save
@homework = HomeworkCommon.find @homework.id @homework = HomeworkCommon.find @homework.id
@homework.student_works.each do |student_work| @homework.student_works.each do |student_work|
@ -1628,11 +1626,11 @@ class StudentWorkController < ApplicationController
sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,12] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score) sheet1[count_row,12] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,13] = format_time(homework.created_at) sheet1[count_row,13] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
else else
sheet1[count_row,9] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty sheet1[count_row,9] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score) sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,11] = format_time(homework.created_at) sheet1[count_row,11] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
end end
count_row += 1 count_row += 1
end end
@ -1661,11 +1659,11 @@ class StudentWorkController < ApplicationController
sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
sheet1[count_row,12] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty sheet1[count_row,12] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,13] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score) sheet1[count_row,13] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,14] = format_time(homework.created_at) sheet1[count_row,14] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
else else
sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,11] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score) sheet1[count_row,11] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,12] = format_time(homework.created_at) sheet1[count_row,12] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
end end
count_row += 1 count_row += 1
end end
@ -1690,11 +1688,11 @@ class StudentWorkController < ApplicationController
sheet1[count_row,7] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty sheet1[count_row,7] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score) sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,10] = format_time(homework.created_at) sheet1[count_row,10] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
else else
sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,7] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score) sheet1[count_row,7] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,8] = format_time(homework.created_at) sheet1[count_row,8] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
end end
count_row += 1 count_row += 1
end end
@ -1820,95 +1818,88 @@ class StudentWorkController < ApplicationController
#成绩计算 #成绩计算
def set_final_score homework,student_work def set_final_score homework,student_work
if homework && homework.homework_detail_manual 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 homework.homework_type != 2 #非编程作业
if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score
if student_work.teacher_score if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.teacher_score if student_work.student_score.nil?
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty student_work.final_score = student_work.teacher_score
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 else
ta_proportion = homework.homework_detail_manual.ta_proportion te_proportion = tea_proportion + tea_ass_proportion / 2
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") 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("#{ta_proportion}")) final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_ta_score + final_s_score final_score = final_te_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f) student_work.final_score = format("%.2f",final_score.to_f)
end end
if student_work.final_score else
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty if student_work.student_score.nil?
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score 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 else
student_work.work_score = nil 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
end end
else #不考虑教师评分 else
if student_work.teaching_asistant_score.nil? if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.student_score student_work.final_score = student_work.student_score
elsif student_work.student_score.nil? elsif student_work.student_score.nil?
student_work.final_score = student_work.teaching_asistant_score student_work.final_score = student_work.teaching_asistant_score
else else
ta_proportion = homework.homework_detail_manual.ta_proportion ta_proportion = tea_ass_proportion + tea_proportion / 2
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") 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_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f) student_work.final_score = format("%.2f",final_score.to_f)
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
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空 elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
if homework.teacher_priority == 1 #教师优先 #if homework.teacher_priority == 1 #教师优先
if student_work.teacher_score sy_proportion = homework.homework_detail_programing.ta_proportion
student_work.final_score = student_work.teacher_score if student_work.teacher_score
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty if student_work.teaching_asistant_score.nil? #教辅未评分
else if student_work.student_score.nil?
if student_work.teaching_asistant_score.nil? #教辅未评分 ta_proportion = tea_proportion + (1 - tea_proportion - sy_proportion) / 2
if student_work.student_score.nil? final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{ta_proportion}")
student_work.final_score = student_work.system_score final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
else final_score = final_sy_score + final_te_score
ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2 student_work.final_score = format("%.2f",final_score.to_f)
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 = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_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 else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") rest_proportion = tea_ass_proportion / 3
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}") final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")) final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_score = final_sy_score + final_ts_score + final_st_score 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) student_work.final_score = format("%.2f",final_score.to_f)
end end
if student_work.final_score elsif student_work.student_score.nil? #学生未评分
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty rest_proportion = (1 - tea_proportion - sy_proportion - tea_ass_proportion) / 3
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
else final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
student_work.work_score = nil 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}"))
end 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 end
else #不考虑教师评分 else
if student_work.teaching_asistant_score.nil? #教辅未评分 if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil? if student_work.student_score.nil?
student_work.final_score = student_work.system_score student_work.final_score = student_work.system_score
else else
ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2 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_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_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score final_score = final_sy_score + final_st_score
@ -1918,27 +1909,29 @@ class StudentWorkController < ApplicationController
if student_work.teaching_asistant_score.nil? if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score student_work.final_score = student_work.system_score
else else
ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2 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_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_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_score = final_sy_score + final_ts_score
student_work.final_score = format("%.2f",final_score.to_f) student_work.final_score = format("%.2f",final_score.to_f)
end end
else else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") rest_proportion = tea_proportion / 3
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}") final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_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 final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f) student_work.final_score = format("%.2f",final_score.to_f)
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
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
end end

View File

@ -1408,11 +1408,9 @@ class UsersController < ApplicationController
render_attachment_warning_if_needed(homework) render_attachment_warning_if_needed(homework)
homework_detail_manual = HomeworkDetailManual.new homework_detail_manual = HomeworkDetailManual.new
if homework.anonymous_comment == 1 homework_detail_manual.te_proportion = 1.0
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.4 : 1.0 homework_detail_manual.ta_proportion = 0
else
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.3 : 0.6
end
if params[:homework_common][:end_time] == "" if params[:homework_common][:end_time] == ""
homework_detail_manual.comment_status = 0 homework_detail_manual.comment_status = 0
else else
@ -1446,11 +1444,7 @@ class UsersController < ApplicationController
if homework.homework_type == 2 if homework.homework_type == 2
homework_detail_programing = HomeworkDetailPrograming.new homework_detail_programing = HomeworkDetailPrograming.new
homework.homework_detail_programing = homework_detail_programing homework.homework_detail_programing = homework_detail_programing
if homework.anonymous_comment == 1 homework_detail_programing.ta_proportion = 0
homework_detail_programing.ta_proportion = 0.6
else
homework_detail_programing.ta_proportion = 0.5
end
homework_detail_programing.language = params[:language_type].to_i homework_detail_programing.language = params[:language_type].to_i
sample_inputs = params[:sample][:input] sample_inputs = params[:sample][:input]

View File

@ -4135,7 +4135,7 @@ def create_works_list homework
end end
def add_to_homework_bank_f homework def add_to_homework_bank_f homework
homework_bank = HomeworkBank.new(:name => homework.name, :description => homework.description, :user_id => homework.user_id, :homework_type => homework.homework_type, homework_bank = HomeworkBank.new(:name => homework.name, :description => homework.description, :user_id => User.current.id, :homework_type => homework.homework_type,
:quotes => 1, :is_public => homework.course.is_public, :applicable_syllabus => homework.course.syllabus.title, :homework_common_id => homework.id) :quotes => 1, :is_public => homework.course.is_public, :applicable_syllabus => homework.course.syllabus.title, :homework_common_id => homework.id)
if homework.homework_type == 2 && homework.homework_detail_programing if homework.homework_type == 2 && homework.homework_detail_programing
homework_bank.language = homework.homework_detail_programing.language homework_bank.language = homework.homework_detail_programing.language

View File

@ -37,14 +37,46 @@ class HomeworkCommon < ActiveRecord::Base
after_update :update_activity after_update :update_activity
after_save :act_as_course_activity after_save :act_as_course_activity
after_destroy :delete_kindeditor_assets after_destroy :delete_kindeditor_assets
before_destroy :update_homework_bank_quotes before_destroy :update_homework_bank_quotes, :update_course_statistics
#删除时更新题库中的引用数 #删除时更新题库中的引用数
def update_homework_bank_quotes def update_homework_bank_quotes
old_banks = HomeworkBank.where(:homework_common_id => self.id) old_banks = HomeworkBank.where(:id => self.homework_bank_id)
unless old_banks.blank? unless old_banks.blank?
old_banks.each do |bank| old_banks.first.update_attributes(:quotes => (old_banks.first.quotes - 1) > 0 ? (old_banks.first.quotes - 1) : 0, :homework_common_id => nil)
bank.update_attributes(:quotes => (bank.quotes - 1) > 0 ? (bank.quotes - 1) : 0, :homework_common_id => nil) end
HomeworkBank.where(:homework_common_id => self.id).update_all(:homework_common_id => nil)
end
#更新CourseHomeworkStatistics中每个学生的未交作品数、已交作品数、迟交作品数
def update_course_statistics
course = self.course
hw_count = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
homework_ids = course.homework_commons.empty? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and work_status !=0")
is_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 2")
is_eva_student_works = StudentWork.where(:homework_common_id => is_eva_homeworks.map{|hw| hw.id})
has_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 3")
has_eva_student_works = StudentWork.where(:homework_common_id => has_eva_homeworks.map{|hw| hw.id})
course.student.each do |student|
user = student.student
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(course.id, student.student_id)
if user && course_statistics
committed_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status != 0").count
un_commit_work_num = (hw_count - committed_work_num) < 0 ? 0 : (hw_count - committed_work_num)
late_commit_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status = 2").count
absence_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => has_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => has_eva_student_works.map(&:id)).group_by(&:student_work_id).count
absence_evaluation_work_num = absence_evaluation_work_num < 0 ? 0 : absence_evaluation_work_num
un_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => is_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => is_eva_student_works.map(&:id)).group_by(&:student_work_id).count
un_evaluation_work_num = un_evaluation_work_num < 0 ? 0 : un_evaluation_work_num
appeal_num = user.student_works_scores.where(:student_work_id => student_works.map(&:id), :appeal_status => 3).count
average_score = user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first.score : 0
total_score = user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
course_statistics.update_attributes(:committed_work_num => committed_work_num, :un_commit_work_num => un_commit_work_num,
:late_commit_work_num => late_commit_work_num, :absence_evaluation_work_num => absence_evaluation_work_num, :un_evaluation_work_num => un_evaluation_work_num,
:appeal_num => appeal_num, :average_score => average_score, :total_score => total_score)
end end
end end
end end

View File

@ -1,7 +1,7 @@
#手动评分作业表 #手动评分作业表
#comment_status: 1:未开启匿评2开启匿评3匿评结束 #comment_status: 1:未开启匿评2开启匿评3匿评结束
class HomeworkDetailManual < ActiveRecord::Base class HomeworkDetailManual < ActiveRecord::Base
attr_accessible :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
belongs_to :homework_common belongs_to :homework_common
end end

View File

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

@ -1053,6 +1053,17 @@ class User < Principal
end end
end end
#是否是老师(不包括助教)
def teacher_of_course(course)
member = course.members.where("user_id = #{self.id}").first
if !member.nil?
role = MemberRole.where("member_id = #{member.id} and role_id in (3, 9)")
!role.blank?
else
return false
end
end
#是否具有老师角色 #是否具有老师角色
def has_teacher_role(course) def has_teacher_role(course)
member = course.members.where("user_id = #{self.id}").first member = course.members.where("user_id = #{self.id}").first

View File

@ -67,7 +67,7 @@
<div class="alert alert-orange mb15 ml30 mr80 mt10"> <div class="alert alert-orange mb15 ml30 mr80 mt10">
注意:开启匿评时尚未提交作品的同学,将不参与匿评 注意:开启匿评时尚未提交作品的同学,将不参与匿评
</div> </div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr80" onclick="submit_set_evaluation_attr('<%= @homework.end_time%>');">确定</a> <a href="javascript:void(0);" class="fr sy_btn_blue mr80" onclick="submit_set_evaluation_attr('<%= @homework.end_time.strftime("%Y-%m-%d")%>');">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a> <a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div> </div>
</div> </div>

View File

@ -103,37 +103,29 @@
<li class="mb10 mt10 fl"> <li class="mb10 mt10 fl">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label> <label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label> <ul class="fl ml5">
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 141px;">
<em></em>
<span></span>
<p>教师评分-迟交扣分-缺评扣分-违规匿评扣分</p>
</div>
<li class="mb10 fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<ul class="fl">
<li class="clear"> <li class="clear">
<input type="radio" class="fl" id="other_score" value="0" name="teacher_priority"/> <span class="fl">教师评分</span>
<label for="other_score" class="fl ml5">助教评分+学生匿评</label> <%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li> </li>
<li class="clear"> <li class="clear mt5">
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> <span class="fl">助教评分</span>
<span class="fl ml5">助教评分</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>
<li class="clear"> <li class="clear mt5">
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion * 100).to_i%>%" class="fl ml15" readonly> <span class="fl">学生匿评</span>
<span class="fl ml5">学生匿评</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> </li>
</ul> </ul>
<div class="fl clear popup_tip_box fontGrey2 w230" style="margin-left: 78px;">
<em></em>
<span></span>
<p >助教评分*其百分比+ <br/>
学生匿评平均分*其百分比- <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
</div>
</li> </li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 78px;">
<em></em>
<span></span>
<p>教师评分 * 其百分比+ <br/>
助教评分 * 其百分比+ <br/>
学生匿评平均分 * 其百分比 - <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
</div>
</ul> </ul>
<div class="cl"></div> <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_blue mr50" onclick="set_score_rule_submit();">确定</a>
@ -145,9 +137,16 @@
<script> <script>
$(function(){ $(function(){
$("#ta_proportion").change(function(){ $("#te_proportion").die();
var ta_proportion = parseFloat($("#ta_proportion").val()); $("#ta_proportion").die();
$("#student_proportion").val((100 - parseFloat(parseInt(ta_proportion * 100))) + "%"); $("#te_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100);
$("#ta_proportion").replaceWith(build_selector(ta_proportion));
$("#student_proportion").val("0%");
});
$("#ta_proportion").live('change', function(){
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 %> <% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked"); $("#teacher_score").attr("checked", "checked");

View File

@ -41,25 +41,25 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<span class="separator_short"></span> <span class="separator_short"></span>
<li class="mb10"> <li class="mb10 fl">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label> <label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/> <!--<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/>-->
<label for="teacher_score" class=" fl ml5">教师评分</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>
<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>
</li> </li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;"> <div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 29px;">
<em></em> <em></em>
<span></span> <span></span>
<p >教师评分 - 迟交扣分 </p> <p >教师评分 * 其百分比 + <br/>助教评分 * 其百分比 - <br/> 迟交扣分 </p>
</div>
<li class="mb10">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" id="other_score" value="0" name="teacher_priority"/>
<label for="other_score" class="fl ml5">助教评分</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 - 迟交扣分 </p>
</div> </div>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>
@ -72,6 +72,14 @@
<script> <script>
$(function(){ $(function(){
$("#te_proportion").die();
$("#te_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100);
$("#ta_proportion").val(ta_proportion + "%");
$("input[name='ta_proportion']").val(ta_proportion/100);
});
<% if homework.teacher_priority == 1 %> <% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked"); $("#teacher_score").attr("checked", "checked");
<% else %> <% else %>

View File

@ -103,42 +103,34 @@
<li class="mb10 mt10 fl"> <li class="mb10 mt10 fl">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label> <label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label> <ul class="fl ml5">
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 141px;">
<em></em>
<span></span>
<p>教师评分-迟交扣分-缺评扣分-违规匿评扣分</p>
</div>
<li class="mb10 fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<ul class="fl">
<li class="clear"> <li class="clear">
<input type="radio" class="fl" id="other_score" value="0" name="teacher_priority"/> <span class="fl">教师评分</span>
<label for="other_score" class="fl ml5">系统评分+助教评分+学生匿评</label> <%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li> </li>
<li class="clear"> <li class="clear mt5">
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %> <span class="fl">助教评分</span>
<span class="fl ml5">系统评分</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>
<li class="clear"> <li class="clear mt5">
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing.ta_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> <span class="fl">系统评分</span>
<span class="fl ml5">助教评分</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>
<li class="clear"> <li class="clear mt5">
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing.ta_proportion * 100).to_i%>" class="fl ml15" readonly> <span class="fl">学生匿评</span>
<span class="fl ml5">学生匿评</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> </li>
</ul> </ul>
<div class="fl clear popup_tip_box fontGrey2 w230" style="margin-left: 27px;">
<em></em>
<span></span>
<p>系统评分*其百分比+ <br/>
助教评 *其百分比+ <br/>
学生匿评平均分*其百分比 - <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
</div>
</li> </li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 73px;">
<em></em>
<span></span>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 + <br/>
系统评分 * 其百分比 + <br/>
学生匿评平均分 * 其百分比 - <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
</div>
</ul> </ul>
<div class="cl"></div> <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_blue mr50" onclick="set_score_rule_submit();">确定</a>
@ -150,14 +142,24 @@
</div> </div>
<script> <script>
$(function(){ $(function(){
$("#sy_proportion").live('change', function(){ $("#te_proportion").die();
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100); $("#ta_proportion").die();
$("#sy_proportion").die();
$("#te_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100);
$("#ta_proportion").replaceWith(build_selector(ta_proportion)); $("#ta_proportion").replaceWith(build_selector(ta_proportion));
$("#sy_proportion").replaceWith(build_selector_sy(0));
$("#student_proportion").val("0%"); $("#student_proportion").val("0%");
}); });
$("#ta_proportion").live("change",function(){ $("#ta_proportion").live("change",function(){
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100); var sy_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#student_proportion").val(ta_proportion + "%"); $("#sy_proportion").replaceWith(build_selector_sy(sy_proportion));
$("#student_proportion").val("0%");
});
$("#sy_proportion").live("change",function(){
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 %> <% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked"); $("#teacher_score").attr("checked", "checked");

View File

@ -43,37 +43,28 @@
<span class="separator_short"></span> <span class="separator_short"></span>
<li class="mb10 fl"> <li class="mb10 fl">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label> <label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/> <!--<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/>-->
<label for="teacher_score" class=" fl ml5">教师评分</label> <ul class="fl ml5">
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<em></em>
<span></span>
<p >教师评分 - 迟交扣分 </p>
</div>
<li class="mb10 fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<ul class="fl">
<li class="clear"> <li class="clear">
<input type="radio" class="fl" id="other_score" value="0" name="teacher_priority"/><label for="other_score" class="fl ml5">系统评分+助教评分</label> <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>
<li class="clear"> <li class="clear mt5">
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %> <span class="fl">助教评分</span>
<span class="fl ml5">系统评分</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>
<li class="clear"> <li class="clear mt5">
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing.ta_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> <span class="fl">系统评分</span>
<span class="fl ml5">助教评分</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> </li>
</ul> </ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190 ml30">
<em></em>
<span></span>
<p >系统评分 * 其百分比 + <br/>
助教评分 * 其百分比 - <br/>
迟交扣分 </p>
</div>
</li> </li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 29px;">
<em></em>
<span></span>
<p >教师评分 * 其百分比 + <br/>助教评分 * 其百分比 + <br/>系统评分 * 其百分比 - <br/> 迟交扣分 </p>
</div>
</ul> </ul>
<div class="cl"></div> <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 mr40" onclick="set_score_rule_submit();">确定</a>
@ -86,13 +77,19 @@
<script> <script>
$(function(){ $(function(){
$("#sy_proportion").live('change', function(){ $("#te_proportion").die();
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100); $("#ta_proportion").die();
$("#te_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100);
$("#ta_proportion").replaceWith(build_selector(ta_proportion)); $("#ta_proportion").replaceWith(build_selector(ta_proportion));
$("#sy_proportion").val("0%");
$("input[name='sy_proportion']").val(0);
}); });
$("#ta_proportion").live('change', function(){ $("#ta_proportion").live('change', function(){
var sy_proportion = 100 - parseInt(parseFloat($("#ta_proportion").val()) * 100); var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#sy_proportion").replaceWith(build_selector_sy(sy_proportion)); $("#sy_proportion").val(ta_proportion + "%");
$("input[name='sy_proportion']").val(ta_proportion/100);
}); });
<% if homework.teacher_priority == 1 %> <% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked"); $("#teacher_score").attr("checked", "checked");

View File

@ -122,17 +122,16 @@
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%> :title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li> </li>
<% end %> <% end %>
<% if (User.current.teacher_of_course(activity.course) || activity.user == User.current) && User.current.homework_banks.where(:homework_common_id => activity.id).empty? %>
<li>
<%= link_to("加入题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 1),:class => "wpostOptionLink", :remote => true)%>
</li>
<% end %>
<% if activity.user == User.current %> <% if activity.user == User.current %>
<% if activity.homework_bank_id.nil? %> <% if activity.is_update && !User.current.homework_banks.where(:homework_common_id => activity.id).blank? %>
<li> <li>
<%= link_to("加入题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 1),:class => "wpostOptionLink", :remote => true)%> <%= link_to("同步到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 2),:class => "wpostOptionLink", :remote => true)%>
</li> </li>
<% elsif activity.is_update %>
<% if activity.user == activity.homework_bank.user %>
<li>
<%= link_to("同步到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 2),:class => "wpostOptionLink", :remote => true)%>
</li>
<% end %>
<li> <li>
<%= link_to("另存到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 3),:class => "wpostOptionLink", :remote => true)%> <%= link_to("另存到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 3),:class => "wpostOptionLink", :remote => true)%>
</li> </li>

View File

@ -0,0 +1,27 @@
class AddTeProportionToHomework < ActiveRecord::Migration
def change
add_column :homework_detail_manuals, :te_proportion, :float, :default => 1.0
count = HomeworkDetailManual.all.count / 30 + 2
transaction do
for i in 1 ... count do i
HomeworkDetailManual.page(i).per(30).each do |homework|
if homework.homework_common
homework_common = homework.homework_common
homework_detail_programing = homework_common.homework_detail_programing
if homework_common.teacher_priority == 1
if homework_detail_programing
homework_detail_programing.update_column("ta_proportion", 0.0)
end
homework.update_column("ta_proportion", 0.0)
else
homework.update_column("te_proportion", 0.0)
end
else
homework.destroy
end
end
end
end
end
end

View File

@ -658,7 +658,7 @@ function build_selector(max_num){
} }
function build_selector_sy(max_num){ function build_selector_sy(max_num){
var html = "<select class='w61 fl ml15' id='sy_proportion' name='sy_proportion'>"; var html = "<select class='w61 fl ml15' id='sy_proportion' name='sy_proportion'>";
for(var i = 0; i <= 100; i += 10){ for(var i = 0; i <= max_num; i += 10){
if( i == max_num){ if( i == max_num){
html += "<option value='" + parseFloat(i)/100 + "' selected='selected'>" + i + "%</option>"; html += "<option value='" + parseFloat(i)/100 + "' selected='selected'>" + i + "%</option>";
}else{ }else{