|
|
|
@ -549,7 +549,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
course_member = CourseMember.find_by!(id: params[:course_member_id].to_i, course_id: @course.id)
|
|
|
|
|
tip_exception("删除失败") if course_member.CREATOR? or course_member.STUDENT?
|
|
|
|
|
|
|
|
|
|
course_student = CourseMember.find_by(id: course_member.user_id, course_id: @course.id, role: %i[STUDENT])
|
|
|
|
|
course_student = CourseMember.find_by(user_id: course_member.user_id, course_id: @course.id, role: %i[STUDENT])
|
|
|
|
|
course_member.destroy!
|
|
|
|
|
course_student.update_attributes(is_active: 1) if course_student.present? && !course_student.is_active
|
|
|
|
|
normal_status(0, "删除成功")
|
|
|
|
@ -772,8 +772,10 @@ class CoursesController < ApplicationController
|
|
|
|
|
students.each do |student|
|
|
|
|
|
course_member = CourseMember.find_by(id: student[:course_member_id].to_i, course_id: @course.id)
|
|
|
|
|
if course_member.present?
|
|
|
|
|
member_teacher = CourseMember.find_by(user_id: course_member.user_id, course_id: @course.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR])
|
|
|
|
|
student_ids << course_member.user_id
|
|
|
|
|
course_member.destroy!
|
|
|
|
|
member_teacher.update_attributes(is_active: 1) if member_teacher.present?
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, student_ids) if student_ids.present?
|
|
|
|
|