|
|
|
@ -153,8 +153,8 @@ class CoursesController < ApplicationController
|
|
|
|
|
begin
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
@course = Course.new(name: params[:name], class_period: params[:class_period], credit: params[:credit],
|
|
|
|
|
end_date: params[:end_date], is_public: params[:is_public], school_id: @school.id,
|
|
|
|
|
authentication: params[:authentication], professional_certification: params[:professional_certification])
|
|
|
|
|
end_date: params[:end_date], is_public: params[:is_public], school_id: @school.id)
|
|
|
|
|
# authentication: params[:authentication], professional_certification: params[:professional_certification])
|
|
|
|
|
@course.tea_id = current_user.id
|
|
|
|
|
|
|
|
|
|
if params[:subject_id].blank?
|
|
|
|
@ -219,8 +219,8 @@ class CoursesController < ApplicationController
|
|
|
|
|
extra_params[:is_end] = 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
extra_params[:authentication] = params[:authentication]
|
|
|
|
|
extra_params[:professional_certification] = params[:professional_certification]
|
|
|
|
|
# extra_params[:authentication] = params[:authentication]
|
|
|
|
|
# extra_params[:professional_certification] = params[:professional_certification]
|
|
|
|
|
|
|
|
|
|
if @course.subject
|
|
|
|
|
@course.start_date = params[:start_date]
|
|
|
|
@ -1157,10 +1157,10 @@ class CoursesController < ApplicationController
|
|
|
|
|
return normal_status(-1, "课堂已结束,无法加入") if course.is_end
|
|
|
|
|
|
|
|
|
|
# 实名认证和职业认证的身份判断
|
|
|
|
|
return normal_status(-2, "该课堂要求成员完成实名和职业认证") if course.authentication &&
|
|
|
|
|
course.professional_certification && (!current_user.authentication && !current_user.professional_certification)
|
|
|
|
|
return normal_status(-2, "该课堂要求成员完成实名认证") if course.authentication && !current_user.authentication
|
|
|
|
|
return normal_status(-2, "该课堂要求成员完成职业认证") if course.professional_certification && !current_user.professional_certification
|
|
|
|
|
# return normal_status(-2, "该课堂要求成员完成实名和职业认证") if course.authentication &&
|
|
|
|
|
# course.professional_certification && (!current_user.authentication && !current_user.professional_certification)
|
|
|
|
|
# return normal_status(-2, "该课堂要求成员完成实名认证") if course.authentication && !current_user.authentication
|
|
|
|
|
# return normal_status(-2, "该课堂要求成员完成职业认证") if course.professional_certification && !current_user.professional_certification
|
|
|
|
|
|
|
|
|
|
# 身份验证
|
|
|
|
|
if params[:professor].blank? && params[:assistant_professor].blank? && params[:student].blank?
|
|
|
|
@ -1452,6 +1452,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
# Never trust parameters from the scary internet, only allow the white list through.
|
|
|
|
|
def course_params
|
|
|
|
|
params.require(:course).permit(:name, :class_period, :credit, :end_date, :is_public, :authentication, :professional_certification)
|
|
|
|
|
# params.require(:course).permit(:name, :class_period, :credit, :end_date, :is_public, :authentication, :professional_certification)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def validate_course_name
|
|
|
|
|