作业动态报500

This commit is contained in:
cxt 2016-11-14 17:32:18 +08:00
parent 5605a9e638
commit ef9b389cfc
3 changed files with 36 additions and 11 deletions

View File

@ -4,7 +4,7 @@ class StudentWork < ActiveRecord::Base
belongs_to :homework_common
belongs_to :user
has_many :student_work_projects
has_many :student_work_projects, :dependent => :destroy
has_many :student_works_evaluation_distributions, :dependent => :destroy
has_many :student_works_scores, :dependent => :destroy
belongs_to :project

View File

@ -0,0 +1,17 @@
class DeleteNullStudnetWorkProject < ActiveRecord::Migration
def up
count = StudentWorkProject.all.count / 30 + 2
transaction do
for i in 1 ... count do i
StudentWorkProject.page(i).per(30).each do |sp|
if !sp.student_work_id.nil? && sp.student_work.nil?
sp.destroy
end
end
end
end
end
def down
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 => 20161111081619) do
ActiveRecord::Schema.define(:version => 20161114092115) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -325,16 +325,14 @@ ActiveRecord::Schema.define(:version => 20161111081619) do
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
create_table "changesets", :force => true do |t|
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.string "committer"
t.datetime "committed_on", :null => false
t.datetime "committed_on", :null => false
t.text "comments"
t.date "commit_date"
t.string "scmid"
t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
@ -518,6 +516,20 @@ ActiveRecord::Schema.define(:version => 20161111081619) do
t.integer "container_id", :default => 0
end
create_table "course_class_post", :id => false, :force => true do |t|
t.integer "班级id", :default => 0, :null => false
t.string "班级名"
t.integer "帖子id", :default => 0, :null => false
t.integer "主贴id"
t.string "帖子标题", :default => "", :null => false
t.text "帖子内容"
t.integer "帖子用户id"
t.integer "帖子回复数", :default => 0, :null => false
t.integer "最后回帖id"
t.datetime "发帖时间", :null => false
t.datetime "帖子更新时间", :null => false
end
create_table "course_contributor_scores", :force => true do |t|
t.integer "course_id"
t.integer "user_id"
@ -995,10 +1007,6 @@ ActiveRecord::Schema.define(:version => 20161111081619) do
t.datetime "updated_at", :null => false
end
create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a"
end
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"