手动评分作业、编程作业相关表的添加以及关系的定义

This commit is contained in:
sw 2015-05-19 10:20:07 +08:00
parent 7bfd7755f7
commit bb3e0c4c7e
7 changed files with 69 additions and 5 deletions

View File

@ -5,5 +5,7 @@ class HomeworkCommon < ActiveRecord::Base
belongs_to :course
belongs_to :user
has_many :homework_detail_manuals, :dependent => :destroy
has_one :homework_detail_manual, :dependent => :destroy
has_one :homework_detail_programing, :dependent => :destroy
has_many :homework_tests, :dependent => :destroy
end

View File

@ -1,3 +1,5 @@
#手动评分作业表
#comment_status: 1:未开启匿评2开启匿评3匿评结束
class HomeworkDetailManual < ActiveRecord::Base
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id

View File

@ -0,0 +1,5 @@
class HomeworkDetailPrograming < ActiveRecord::Base
attr_accessible :language, :standard_code, :homework_common_id
belongs_to :homework_common
end

View File

@ -0,0 +1,5 @@
class HomeworkTest < ActiveRecord::Base
attr_accessible :input, :output, :homework_common_id
belongs_to :homework_common
end

View File

@ -0,0 +1,11 @@
class CreateHomeworkDetailProgramings < ActiveRecord::Migration
def change
create_table :homework_detail_programings do |t|
t.string :language
t.text :standard_code, :limit => 4294967295
t.integer :homework_common_id
t.timestamps
end
end
end

View File

@ -0,0 +1,11 @@
class CreateHomeworkTests < ActiveRecord::Migration
def change
create_table :homework_tests do |t|
t.text :input
t.text :output
t.integer :homework_common_id
t.timestamps
end
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 => 20150519012744) do
ActiveRecord::Schema.define(:version => 20150519020031) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -549,13 +549,33 @@ ActiveRecord::Schema.define(:version => 20150519012744) do
t.text "description"
t.date "publish_time"
t.date "end_time"
t.integer "type", :default => 1
t.integer "homework_type", :default => 1
t.string "late_penalty"
t.integer "course_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "homework_detail_manuals", :force => true 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.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "homework_detail_programings", :force => true do |t|
t.string "language"
t.text "standard_code", :limit => 2147483647
t.integer "homework_common_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "homework_evaluations", :force => true do |t|
t.string "user_id"
t.string "homework_attach_id"
@ -571,6 +591,14 @@ ActiveRecord::Schema.define(:version => 20150519012744) do
add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
create_table "homework_tests", :force => true do |t|
t.text "input"
t.text "output"
t.integer "homework_common_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "homework_users", :force => true do |t|
t.string "homework_attach_id"
t.string "user_id"