评分设置

This commit is contained in:
cxt 2016-04-22 17:33:49 +08:00
parent dcb150559e
commit 379859db67
2 changed files with 8 additions and 7 deletions

View File

@ -76,8 +76,9 @@ class HomeworkCommonController < ApplicationController
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
@homework.end_time = params[:homework_common][:end_time] || Time.now
@homework.course_id = params[:course_id]
if params[:homework_common][:anonymous_comment] && params[:homework_common][:anonymous_comment] != @homework.anonymous_comment
if @homework.anonymous_comment == 1
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0
if anonymous != @homework.anonymous_comment
if anonymous == 1
homework_detail_manual.ta_proportion = @homework.homework_type == 1 ? 1.0 : 0.4
else
homework_detail_manual.ta_proportion = @homework.homework_type == 1 ? 0.6 : 0.3
@ -100,8 +101,8 @@ class HomeworkCommonController < ApplicationController
@homework.homework_detail_programing ||= HomeworkDetailPrograming.new
@homework_detail_programing = @homework.homework_detail_programing
@homework_detail_programing.language = params[:language_type].to_i
if params[:homework_common][:anonymous_comment] && params[:homework_common][:anonymous_comment] != @homework.anonymous_comment
if @homework.anonymous_comment == 1
if anonymous != @homework.anonymous_comment
if anonymous == 1
@homework_detail_programing.ta_proportion = 0.6
else
@homework_detail_programing.ta_proportion = 0.5
@ -129,9 +130,9 @@ class HomeworkCommonController < ApplicationController
@homework_detail_group.base_on_project = params[:base_on_project].to_i
end
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0
if @homework.save
@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_group.save if @homework_detail_group

View File

@ -25,7 +25,7 @@
});
$("#ta_proportion").live("change",function(){
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion")).val() * 100);
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#student_proportion").val(ta_proportion + "%");
});
</script>