diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index a49e2b35e..d932f641e 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -9,4 +9,5 @@ class HomeworkCommon < ActiveRecord::Base has_one :homework_detail_programing, :dependent => :destroy has_many :homework_tests, :dependent => :destroy has_many :student_works, :dependent => :destroy + has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 4e61a4c18..f3573c139 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -5,4 +5,5 @@ class StudentWork < ActiveRecord::Base belongs_to :homework_common belongs_to :user has_many :student_works_evaluation_distributions, :dependent => :destroy + has_many :student_works_scores, :dependent => :destroy end diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb new file mode 100644 index 000000000..6d4fba281 --- /dev/null +++ b/app/models/student_works_score.rb @@ -0,0 +1,6 @@ +class StudentWorksScore < ActiveRecord::Base + attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role + + belongs_to :user + belongs_to :student_work +end diff --git a/app/models/user.rb b/app/models/user.rb index 44fbe8ff0..a74025050 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -85,6 +85,7 @@ class User < Principal has_many :homework_commons, :dependent => :destroy has_many :student_works, :dependent => :destroy has_many :student_works_evaluation_distributions, :dependent => :destroy + has_many :student_works_scores, :dependent => :destroy #end has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, diff --git a/db/migrate/20150519030544_create_student_works_scores.rb b/db/migrate/20150519030544_create_student_works_scores.rb new file mode 100644 index 000000000..1a43df966 --- /dev/null +++ b/db/migrate/20150519030544_create_student_works_scores.rb @@ -0,0 +1,12 @@ +class CreateStudentWorksScores < ActiveRecord::Migration + def change + create_table :student_works_scores do |t| + t.integer :student_work_id + t.integer :user_id + t.integer :score + t.text :comment + t.integer :reviewer_role + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 9ea140a32..489dd03dd 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 => 20150519023821) do +ActiveRecord::Schema.define(:version => 20150519030544) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1218,6 +1218,16 @@ ActiveRecord::Schema.define(:version => 20150519023821) do t.datetime "updated_at", :null => false end + create_table "student_works_scores", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.integer "score" + t.text "comment" + t.integer "reviewer_role" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "students_for_courses", :force => true do |t| t.integer "student_id" t.integer "course_id"