|
|
|
@ -170,11 +170,12 @@ class GraduationTopicsController < ApplicationController
|
|
|
|
|
teacher_group = @course.teacher_course_groups.where(:user_id => @graduation_topic.tea_id, :id => params[:group_id]).first
|
|
|
|
|
unless teacher_group.present?
|
|
|
|
|
member = @course.course_members.where(:user_id => @graduation_topic.tea_id).first
|
|
|
|
|
tip_exception("分班名称不能为空") if params[:course_group_name].blank?
|
|
|
|
|
course_group = CourseGroup.find_or_create_by!(:name => params[:course_group_name], :course_id => @course.id)
|
|
|
|
|
teacher_group = TeacherCourseGroup.find_or_create_by!(:course_id => @course.id, :course_member_id => member.try(:id),
|
|
|
|
|
:user_id => @graduation_topic.tea_id,
|
|
|
|
|
:course_group_id => course_group.try(:id))
|
|
|
|
|
if params[:course_group_name].present?
|
|
|
|
|
course_group = CourseGroup.find_or_create_by!(:name => params[:course_group_name], :course_id => @course.id)
|
|
|
|
|
teacher_group = TeacherCourseGroup.find_or_create_by!(:course_id => @course.id, :course_member_id => member.try(:id),
|
|
|
|
|
:user_id => @graduation_topic.tea_id,
|
|
|
|
|
:course_group_id => course_group.try(:id))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
student_member = @course.course_members.where(:user_id => student_graduation_topic.user_id).first
|
|
|
|
|
student_member.update_attributes(:course_group_id => teacher_group.course_group_id) if student_member.present?
|
|
|
|
|