返回课程的接口补上当前用户是否为课程成员,课程老师信息
This commit is contained in:
parent
a6882d0f88
commit
196ceff138
|
@ -211,7 +211,7 @@ class CoursesService
|
|||
@course.members << m
|
||||
@course.course_infos << course
|
||||
end
|
||||
@course
|
||||
{:course => @course,:img_url => url_to_avatar(@course),:current_user_is_member => current_user.member_of_course?(@course),:current_user_is_teacher => is_course_teacher(current_user,@course)}
|
||||
end
|
||||
|
||||
#验证编辑课程的权限
|
||||
|
@ -248,7 +248,7 @@ class CoursesService
|
|||
course_status = CourseStatus.create(:course_id => course.id, :grade => 0)
|
||||
end
|
||||
end
|
||||
course
|
||||
{:course => course,:img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course)}
|
||||
end
|
||||
|
||||
#退出课程
|
||||
|
|
|
@ -6,6 +6,7 @@ class HomeworkService
|
|||
include WordsHelper
|
||||
include ApiHelper
|
||||
include HomeworkAttachHelper
|
||||
include CoursesHelper
|
||||
|
||||
# 作业详情(老师才显示启动匿评,学生不显示 )
|
||||
# many_times 第几次(作业)
|
||||
|
@ -276,7 +277,7 @@ class HomeworkService
|
|||
hw = bid.homeworks.where("user_id = #{current_user.id}")
|
||||
my_homeworks << hw[0] unless (hw.nil? || hw[0].nil?)
|
||||
end
|
||||
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course),:my_homework => my_homeworks}
|
||||
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course),:my_homework => my_homeworks,:current_user_is_member => current_user.member_of_course?(mp.course),:current_user_is_teacher => is_course_teacher(current_user,mp.course)}
|
||||
end
|
||||
course_list
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue