实践课程的名称长度限制调整

dev_hs
cxt 6 years ago
parent 529a0ee365
commit ab59a180c3

@ -562,16 +562,16 @@ class ShixunsController < ApplicationController
commit_id = commit["id"] commit_id = commit["id"]
end end
# 如果该实训是金课中的实训,则将当前用户加入到当期开课的课
# if StageShixun.exists?(shixun_id: @shixun.id, subject_id: Subject.where(excellent: 1)) if StageShixun.exists?(shixun_id: @shixun.id, subject_id: Subject.where(excellent: 1))
# subject = Subject.where(excellent: 1, id: StageShixun.where(shixun_id: @shixun.id).pluck(:subject_id)).take subject = Subject.where(id: StageShixun.where(shixun_id: @shixun.id).pluck(:subject_id), excellent: 1).take(1)
# course = subject.courses.where("start_date is not null and start_date <= '#{Date.today}' and end_date is not null and end_date >= '#{Date.today}'").take course = subject.courses.where("start_date is not null and start_date <= '#{Date.today}' and end_date is not null and end_date >= '#{Date.today}'").take
# if course.present? && !CourseMember.exists?(course_id: course.id, user_id: current_user.id) if course.present? && !CourseMember.exists?(course_id: course.id, user_id: current_user.id)
# # 为了不影响后续操作用create而不是create! # 为了不影响后续操作用create而不是create!
# CourseMember.create(course_id: course.id, user_id: current_user.id, role: 4) CourseMember.create(course_id: course.id, user_id: current_user.id, role: 4)
# CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id]) CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id])
# end end
# end end
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin

@ -149,7 +149,7 @@ class SubjectsController < ApplicationController
end end
def choose_subject_shixun def choose_subject_shixun
@search = params[:search] @search = params[:search].strip
@type = params[:type] @type = params[:type]
# 超级管理员用户显示所有未隐藏的实训、非管理员显示合作团队用户的实训(对本单位公开且未隐藏) # 超级管理员用户显示所有未隐藏的实训、非管理员显示合作团队用户的实训(对本单位公开且未隐藏)
if current_user.admin? if current_user.admin?
@ -163,7 +163,7 @@ class SubjectsController < ApplicationController
tag_ids = @shixuns.joins(:shixun_tag_repertoires).pluck(:tag_repertoire_id).uniq tag_ids = @shixuns.joins(:shixun_tag_repertoires).pluck(:tag_repertoire_id).uniq
@tags = TagRepertoire.select([:id, :name]).where(id: tag_ids) @tags = TagRepertoire.select([:id, :name]).where(id: tag_ids)
if params[:search] unless @search.blank?
@shixuns = @shixuns.where("name like ?", "%#{@search}%") @shixuns = @shixuns.where("name like ?", "%#{@search}%")
end end

@ -21,7 +21,7 @@ class Subject < ApplicationRecord
# 开放课堂 # 开放课堂
has_many :courses, -> { order("courses.id ASC") } has_many :courses, -> { order("courses.id ASC") }
validates :name, length: { maximum: 40 } validates :name, length: { maximum: 60 }
validates :description, length: { maximum: 5000 } validates :description, length: { maximum: 5000 }
validates :learning_notes, length: { maximum: 500 } validates :learning_notes, length: { maximum: 500 }

Loading…
Cancel
Save