学生提交作品表,以及相关的关系
This commit is contained in:
parent
bb3e0c4c7e
commit
3abfaed081
|
@ -8,4 +8,5 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
has_one :homework_detail_manual, :dependent => :destroy
|
||||
has_one :homework_detail_programing, :dependent => :destroy
|
||||
has_many :homework_tests, :dependent => :destroy
|
||||
has_many :student_works, :dependent => :destroy
|
||||
end
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#学生提交作品表
|
||||
class StudentWork < ActiveRecord::Base
|
||||
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score
|
||||
|
||||
belongs_to :homework_common
|
||||
belongs_to :user
|
||||
end
|
|
@ -83,6 +83,7 @@ class User < Principal
|
|||
# end
|
||||
#作业相关关系
|
||||
has_many :homework_commons, :dependent => :destroy
|
||||
has_many :student_works, :dependent => :destroy
|
||||
#end
|
||||
|
||||
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
class CreateStudentWorks < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :student_works do |t|
|
||||
t.string :name
|
||||
t.text :description
|
||||
t.integer :homework_common_id
|
||||
t.integer :user_id
|
||||
t.float :final_score, default: 0
|
||||
t.float :teacher_score, default: 0
|
||||
t.float :student_score, default: 0
|
||||
t.float :teaching_asistant_score, default: 0
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
15
db/schema.rb
15
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150519020031) do
|
||||
ActiveRecord::Schema.define(:version => 20150519022200) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1198,6 +1198,19 @@ ActiveRecord::Schema.define(:version => 20150519020031) do
|
|||
t.integer "project_id"
|
||||
end
|
||||
|
||||
create_table "student_works", :force => true do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.integer "homework_common_id"
|
||||
t.integer "user_id"
|
||||
t.float "final_score", :default => 0.0
|
||||
t.float "teacher_score", :default => 0.0
|
||||
t.float "student_score", :default => 0.0
|
||||
t.float "teaching_asistant_score", :default => 0.0
|
||||
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"
|
||||
|
|
Loading…
Reference in New Issue