分组作业的评分设置

This commit is contained in:
cxt 2016-10-20 14:24:07 +08:00
parent 59f0101a62
commit 269083c4a6
2 changed files with 15 additions and 2 deletions

View File

@ -1063,9 +1063,9 @@ class UsersController < ApplicationController
homework_detail_manual = HomeworkDetailManual.new
if homework.anonymous_comment == 1
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 1.0 : 0.4
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.4 : 1.0
else
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.3 : 0.6
end
if homework.publish_time > Date.today
homework_detail_manual.comment_status = 0

View File

@ -0,0 +1,13 @@
class UpdateGroupHomeworkScoreRule < ActiveRecord::Migration
def up
homeworks = HomeworkCommon.where("homework_type = 3 and anonymous_comment = 1")
homeworks.each do |homework|
if homework.homework_detail_manual
homework.homework_detail_manual.update_column("ta_proportion", 1.0)
end
end
end
def down
end
end