From 1a45a9bee848336fc4443fa83fc1d2143c46e70b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 23 Jul 2019 13:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 542c33652..7a135b031 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -891,7 +891,7 @@ class CoursesController < ApplicationController # end # 创建学生身份 - if params[:student].present? + if params[:student].present? && params[:student].to_i == 1 existing_student = CourseMember.find_by(course_id: course.id, role: %i[STUDENT], user_id: current_user.id) if existing_student.present? # 如果在该课堂已经存在学生身份,且邀请码为分班邀请码,则将其直接加入分班 @@ -911,7 +911,7 @@ class CoursesController < ApplicationController end # 创建教师身份 - if params[:professor].present? || params[:assistant_professor].present? + if (params[:professor].present? && params[:professor].to_i == 1) || (params[:assistant_professor].present? && params[:assistant_professor].to_i == 1) teacher_already_exist = current_user.teacher_of_course_non_active? course unless teacher_already_exist existing_course_message = CourseMessage.find_by(course_id: course.id, course_message_id: current_user.id, @@ -920,8 +920,8 @@ class CoursesController < ApplicationController course_message = CourseMessage.new(course_id: course.id, user_id: course.tea_id, status: 0, course_message_id: current_user.id, course_message_type: "JoinCourseRequest", viewed: false) - course_message.content = 2 if params[:professor].present? - course_message.content = 3 if params[:assistant_professor].present? + course_message.content = 2 if params[:professor].present? && params[:professor].to_i == 1 + course_message.content = 3 if params[:assistant_professor].present? && params[:assistant_professor].to_i == 1 course_message.save!