diff --git a/app/controllers/graduation_topics_controller.rb b/app/controllers/graduation_topics_controller.rb index ce4488ffd..7a61613da 100644 --- a/app/controllers/graduation_topics_controller.rb +++ b/app/controllers/graduation_topics_controller.rb @@ -173,7 +173,7 @@ class GraduationTopicsController < ApplicationController member = @course.course_members.where(:user_id => @graduation_topic.tea_id).first tip_exception("分班名称不能为空") if params[:course_group_name].blank? course_group = CourseGroup.create(:name => params[:course_group_name], :course_id => @course.id) - teacher_group = TeacherCourseGroup.create(:course_id => @course.id, :member_id => member.try(:id), + teacher_group = TeacherCourseGroup.create(:course_id => @course.id, :course_member_id => member.try(:id), :user_id => @graduation_topic.tea_id, :course_group_id => course_group.try(:id)) end @@ -195,7 +195,7 @@ class GraduationTopicsController < ApplicationController user_unaccept_topics = @course.student_graduation_topics.where(user_id: current_user.id, status: [0, 1]) if user_unaccept_topics.size == 0 member_id = @course.course_members.find_by_user_id(current_user.id) - StudentGraduationTopic.create(course_id: @course.id, user_id: current_user.id, member_id: member_id, + StudentGraduationTopic.create(course_id: @course.id, user_id: current_user.id, course_member_id: member_id, graduation_topic_id: @graduation_topic.id) @graduation_topic.update_attribute(:status, 1) normal_status("选题成功") diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index 740e3a993..4df392257 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -266,7 +266,7 @@ class QuestionBanksController < ApplicationController def quote_gtopic_bank topic, course ActiveRecord::Base.transaction do new_topic = GraduationTopic.new - new_topic.attributes = topic.attributes.dup.except("id", "course_id", "user_id", "graduation_topic_id", + new_topic.attributes = topic.attributes.dup.except("id", "course_id", "user_id", "graduation_topic_id", "quotes", "course_list_id", "gtopic_bank_id", "created_at", "updated_at") new_topic.course_id = course.id new_topic.gtopic_bank_id = topic.id diff --git a/db/migrate/20190627012117_modify_quotes_for_gtopic_banks.rb b/db/migrate/20190627012117_modify_quotes_for_gtopic_banks.rb new file mode 100644 index 000000000..4c475fd8f --- /dev/null +++ b/db/migrate/20190627012117_modify_quotes_for_gtopic_banks.rb @@ -0,0 +1,5 @@ +class ModifyQuotesForGtopicBanks < ActiveRecord::Migration[5.2] + def change + change_column :gtopic_banks, :quotes, :integer, :default => 0 + end +end