diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 72e0518bf..50fb07a9e 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -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 diff --git a/app/models/homework_detail_manual.rb b/app/models/homework_detail_manual.rb index ae1941d7d..e0c4dcdcb 100644 --- a/app/models/homework_detail_manual.rb +++ b/app/models/homework_detail_manual.rb @@ -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 diff --git a/app/models/homework_detail_programing.rb b/app/models/homework_detail_programing.rb new file mode 100644 index 000000000..4c7134806 --- /dev/null +++ b/app/models/homework_detail_programing.rb @@ -0,0 +1,5 @@ +class HomeworkDetailPrograming < ActiveRecord::Base + attr_accessible :language, :standard_code, :homework_common_id + + belongs_to :homework_common +end diff --git a/app/models/homework_test.rb b/app/models/homework_test.rb new file mode 100644 index 000000000..f7d9b20bc --- /dev/null +++ b/app/models/homework_test.rb @@ -0,0 +1,5 @@ +class HomeworkTest < ActiveRecord::Base + attr_accessible :input, :output, :homework_common_id + + belongs_to :homework_common +end diff --git a/db/migrate/20150519014639_create_homework_detail_programings.rb b/db/migrate/20150519014639_create_homework_detail_programings.rb new file mode 100644 index 000000000..4a1e248d3 --- /dev/null +++ b/db/migrate/20150519014639_create_homework_detail_programings.rb @@ -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 diff --git a/db/migrate/20150519020031_create_homework_tests.rb b/db/migrate/20150519020031_create_homework_tests.rb new file mode 100644 index 000000000..92b63a412 --- /dev/null +++ b/db/migrate/20150519020031_create_homework_tests.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 6bb0b3900..fa9de32ea 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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,11 +549,31 @@ 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 + 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| @@ -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"