diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index daea45169..508d005a4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -632,7 +632,7 @@ class ApplicationController < ActionController::Base subject = Subject.find_by(id: 149) if subject subject.courses.each do |course| - CourseMember.create!(course_id: course.id, role: 4, user_id: user.id) if !course.course_members.exists?(user_id: user.id) + CourseMember.create!(course_id: course.id, role: 3, user_id: user.id) if !course.course_members.exists?(user_id: user.id) end end end diff --git a/app/models/user.rb b/app/models/user.rb index 3a19a9f87..1dc511513 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -610,29 +610,6 @@ class User < ApplicationRecord admin? || business? end - # 149课程的评审用户数据创建(包含创建课堂学生) - def open_class_user - user = User.find_by(login: "OpenClassUser") - unless user - ActiveRecord::Base.transaction do - user_params = {status: 1, login: "OpenClassUser", lastname: "开放课程", - nickname: "开放课程", professional_certification: 1, certification: 1, grade: 0, - password: "12345678", phone: "11122223333", profile_completed: 1} - user = User.create!(user_params) - - UserExtension.create!(user_id: user.id, gender: 0, school_id: 117, :identity => 1, :student_id => "openclassuser") - - subject = Subject.find_by(id: 149) - if subject - subject.courses.each do |course| - CourseMember.create!(course_id: course.id, role: 4, user_id: user.id) if !course.course_students.exists?(user_id: user.id) - end - end - end - end - user - end - protected def validate_password_length # 管理员的初始密码是5位