学生作品详细得分表,以及相关的关系

This commit is contained in:
sw 2015-05-19 11:18:19 +08:00
parent 08b469fa3c
commit dc1971f507
6 changed files with 32 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)},

View File

@ -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

View File

@ -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"