diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 0304722de..7fa78b635 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -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 #退出课程 diff --git a/app/services/homework_service.rb b/app/services/homework_service.rb index b468e1110..dd2d2356e 100644 --- a/app/services/homework_service.rb +++ b/app/services/homework_service.rb @@ -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