修改进入某个班级报错的BUG
This commit is contained in:
parent
9c560e56b6
commit
c524409e4a
|
@ -57,14 +57,21 @@ module Mobile
|
||||||
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
|
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
current_user = options[:user]
|
current_user = options[:user]
|
||||||
can_setting = false
|
can_setting = false
|
||||||
member = instance.members.where("user_id=#{current_user.id} and course_id=#{instance.id}")[0]
|
|
||||||
|
if instance[:course]
|
||||||
|
course = instance[:course]
|
||||||
|
else
|
||||||
|
course = instance
|
||||||
|
end
|
||||||
|
|
||||||
|
member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
|
||||||
roleName = member.roles[0].name if member
|
roleName = member.roles[0].name if member
|
||||||
|
|
||||||
if roleName && (roleName == "TeachingAsistant" || roleName == "Teacher" )
|
if roleName && (roleName == "TeachingAsistant" || roleName == "Teacher" )
|
||||||
can_setting = true
|
can_setting = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if instance.tea_id == current_user.id
|
if course.tea_id == current_user.id
|
||||||
can_setting = true
|
can_setting = true
|
||||||
end
|
end
|
||||||
can_setting
|
can_setting
|
||||||
|
|
Loading…
Reference in New Issue