Merge remote-tracking branch 'origin/develop' into develop

dev_cs
杨树明 5 years ago
commit 75cca25c23

@ -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

@ -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位

Loading…
Cancel
Save