Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
37acecae61
|
@ -11,7 +11,7 @@ class AddBoardsTypeToBoards < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
board.course_id = project.course_extra.id
|
||||
board.project_id = -1
|
||||
board.save
|
||||
board.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -8,13 +8,19 @@ class StoredCourseProcedure < ActiveRecord::Migration
|
|||
if project.project_type == 1
|
||||
course = Course.find_by_extra(project.identifier)
|
||||
if course
|
||||
course.name = project.name
|
||||
course.description = project.description
|
||||
course.status = project.status
|
||||
course.attachmenttype = 2
|
||||
sql = "update courses set name='" + project.name.to_s + "',description='"
|
||||
sql += project.description.to_s + "',status=" + project.status.to_s
|
||||
sql += ",attachmenttype=2 where id=" +course.id.to_s
|
||||
execute(sql)
|
||||
|
||||
# 以下方式保存,描述等经常不能成功
|
||||
#course.name = project.name
|
||||
#course.description = project.description
|
||||
#course.status = project.status
|
||||
#course.attachmenttype = 2
|
||||
#course.lft = project.lft
|
||||
#course.rgt = project.rgt
|
||||
course.save
|
||||
#course.save(:validate => false)
|
||||
|
||||
# 更新状态表
|
||||
projectstatus = ProjectStatus.find_by_project_id(project.id)
|
||||
|
@ -25,7 +31,7 @@ class StoredCourseProcedure < ActiveRecord::Migration
|
|||
courseStatus.watchers_count = projectstatus.watchers_count
|
||||
courseStatus.grade = projectstatus.grade
|
||||
courseStatus.course_ac_para = projectstatus.course_ac_para
|
||||
courseStatus.save
|
||||
courseStatus.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,12 +6,13 @@ class AddCourseidToEnabledModules < ActiveRecord::Migration
|
|||
#EnabledModule.where('project_id IN (SELECT id FROM projects WHERE project_type=1)').update_all("course_id = project_id")
|
||||
#EnabledModule.where('project_id IN (SELECT id FROM projects WHERE project_type=1)').update_all(project_id: -1)
|
||||
|
||||
|
||||
EnabledModule.all.each do |enablemodule|
|
||||
project = Project.find_by_id(enablemodule.project_id)
|
||||
if project && project.project_type == 1
|
||||
enablemodule.course_id = project.course_extra.id
|
||||
enablemodule.project_id = -1
|
||||
enablemodule.save
|
||||
enablemodule.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ class AddCourseidToToMembers < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
member.course_id = project.course_extra.id
|
||||
member.project_id = -1
|
||||
member.save
|
||||
member.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class RenameProjectIdToHomeworkForCourses < ActiveRecord::Migration
|
|||
project = Project.find_by_id(work.course_id)
|
||||
if project && project.project_type == 1
|
||||
work.course_id = project.course_extra.id
|
||||
work.save
|
||||
work.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ class CreateCourseInfos < ActiveRecord::Migration
|
|||
courseinfo = CourseInfos.new
|
||||
courseinfo.course_id = course.id
|
||||
courseinfo.user_id = projinfo.user_id
|
||||
courseinfo.save
|
||||
courseinfo.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class MigrateCourseTags < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
tagging.taggable_type= 'Course'
|
||||
tagging.taggable_id = project.course_extra.id
|
||||
tagging.save
|
||||
tagging.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class MigrateCourseJournals < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
journal.jour_type = 'Course'
|
||||
journal.jour_id = project.course_extra.id
|
||||
journal.save
|
||||
journal.save(:validate => false)
|
||||
end
|
||||
# 将自动设置的更新日期还原
|
||||
sql = ActiveRecord::Base.connection()
|
||||
|
|
|
@ -47,7 +47,7 @@ class AddCourseRoles < ActiveRecord::Migration
|
|||
role.permissions.append(:view_course_files )
|
||||
role.permissions.append(:view_course_journals_for_messages )
|
||||
role.permissions.append(:view_course_messages )
|
||||
role.save
|
||||
role.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class AddCourseidToNews < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
news.course_id = project.course_extra.id
|
||||
news.project_id = -1
|
||||
news.save
|
||||
news.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class RemoveDataToHomeworkAttach < ActiveRecord::Migration
|
|||
homework.description = biding.description
|
||||
homework.user_id = biding.user_id
|
||||
homework.state = 0
|
||||
homework.save
|
||||
homework.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class MigrateCourseStudents < ActiveRecord::Migration
|
|||
project = Project.find_by_id(student.course_id)
|
||||
if project && project.course_extra
|
||||
student.course_id = project.course_extra.id
|
||||
student.save
|
||||
student.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class MigrateCourseFileType < ActiveRecord::Migration
|
|||
Attachment.all.each do |attach|
|
||||
if attach.container_type == "Course" && attach.attachtype == 1
|
||||
attach.attachtype = 4
|
||||
attach.save
|
||||
attach.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class ModifyStudentRoles < ActiveRecord::Migration
|
|||
role = Role.find_by_name('学生')
|
||||
if role
|
||||
role.permissions.append(:add_messages)
|
||||
role.save
|
||||
role.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
12
db/schema.rb
12
db/schema.rb
|
@ -1041,13 +1041,11 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
|
|||
end
|
||||
|
||||
create_table "user_scores", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.integer "collaboration"
|
||||
t.integer "influence"
|
||||
t.integer "skill"
|
||||
t.integer "active"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
t.integer "collaboration"
|
||||
t.integer "influence"
|
||||
t.integer "skill"
|
||||
t.integer "activity"
|
||||
end
|
||||
|
||||
create_table "user_statuses", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue