增加手动评分相关表,以及关系的定义

This commit is contained in:
sw 2015-05-19 09:56:08 +08:00
parent a43a6289e4
commit 7bfd7755f7
3 changed files with 22 additions and 0 deletions

View File

@ -1,7 +1,9 @@
#老师布置的作业表
#homework_type: 1:普通作业;2:匿评作业;3:编程作业
class HomeworkCommon < ActiveRecord::Base
attr_accessible :name, :user_id, :description, :publish_time, :end_time, :homework_type, :late_penalty, :course_id
belongs_to :course
belongs_to :user
has_many :homework_detail_manuals, :dependent => :destroy
end

View File

@ -0,0 +1,5 @@
class HomeworkDetailManual < ActiveRecord::Base
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id
belongs_to :homework_common
end

View File

@ -0,0 +1,15 @@
class CreateHomeworkDetailManuals < ActiveRecord::Migration
def change
create_table :homework_detail_manuals do |t|
t.float :ta_proportion
t.integer :comment_status
t.date :evaluation_start
t.date :evaluation_end
t.integer :evaluation_num
t.integer :absence_penalty, default: 1
t.integer :homework_common_id
t.timestamps
end
end
end