From 196ceff138478718051aa639d25885ca7a21e1c7 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 12 Feb 2015 15:51:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E8=AF=BE=E7=A8=8B=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A1=A5=E4=B8=8A=E5=BD=93=E5=89=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=98=AF=E5=90=A6=E4=B8=BA=E8=AF=BE=E7=A8=8B=E6=88=90?= =?UTF-8?q?=E5=91=98=EF=BC=8C=E8=AF=BE=E7=A8=8B=E8=80=81=E5=B8=88=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 4 ++-- app/services/homework_service.rb | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) 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