dev_aliyun
cxt 6 years ago
parent 35f0a6fa35
commit cfebe9746f

@ -2967,7 +2967,7 @@ end
member = course.course_members.where(:user_id => user.id, :role => member_role).first
# 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班
if member.present? && member.role == 4 && member.course_group_id != course_group.try(:id).to_i
member.update_column("course_group_id", course_group.try(:id).to_i)
member.update_attributes(course_group_id: course_group.try(:id).to_i)
member_count += 1
elsif !member.present?
member = CourseMember.new(:role => member_role, :user_id => user.id)
@ -2988,9 +2988,9 @@ end
@status = 1
@message = "已导入/更新#{member_count}个成员"
end
rescue
rescue Exception => e
@status = 0
@message = "文件内容无法读取"
@message = e.message
end
else
@status = 0

@ -1,6 +1,6 @@
class CourseGroup < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :course, counter_cache: true
belongs_to :course, :counter_cache => true
has_many :course_members
has_many :members
has_many :memberships, :class_name => 'Member'

Loading…
Cancel
Save