dev_home
cxt 5 years ago
parent 500409edaa
commit dc3672f2d7

@ -796,18 +796,15 @@ class CoursesController < ApplicationController
if approval == 1
course_message.pass!
new_teacher = CourseMember.new(course_id: @course.id, user_id: applier_user.id)
content = course_message.content.to_i
if content == 3 || content == 7
tip_exception("已存在教师/助教身份") if CourseMember.where(course_id: @course.id, user_id: applier_user.id, role: 3).any?
new_teacher.ASSISTANT_PROFESSOR!
elsif content == 2 || content == 9
tip_exception("已存在教师/助教身份") if CourseMember.where(course_id: @course.id, user_id: applier_user.id, role: 2).any?
new_teacher.PROFESSOR!
role = (content == 3 || content == 7) ? 3 : ((content == 2 || content == 9) ? 2 : nil)
if role
tip_exception("已存在教师/助教身份") if CourseMember.where(course_id: @course.id, user_id: applier_user.id, role: [1, 2 ,3]).any?
else
tip_exception("申请角色错误")
end
new_teacher = CourseMember.new(course_id: @course.id, user_id: applier_user.id, role: role)
new_teacher.save!
# 课堂管理员才有分配权限且课堂分班数大于0

Loading…
Cancel
Save