From 411d201fc3694b200ca5e931cde945ee6678ce98 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 4 Mar 2015 17:04:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E7=95=99=E8=A8=80=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/homework.rb | 4 ++++ app/services/homework_service.rb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/api/mobile/entities/homework.rb b/app/api/mobile/entities/homework.rb index 55883e14e..d4c34ffec 100644 --- a/app/api/mobile/entities/homework.rb +++ b/app/api/mobile/entities/homework.rb @@ -52,6 +52,10 @@ module Mobile homework_expose :created_on homework_expose :deadline + expose :jours,using: Mobile::Entities::Jours do |f, opt| + f[:jours] if f.is_a?(Hash) && f.key?(:jours) + end + expose :homework_for_anonymous_comments,using: Mobile::Entities::HomeworkAttach do |f, opt| f[:homework_for_anonymous_comments] if f.is_a?(Hash) && f.key?(:homework_for_anonymous_comments) end diff --git a/app/services/homework_service.rb b/app/services/homework_service.rb index 6287eeef5..d69617eb5 100644 --- a/app/services/homework_service.rb +++ b/app/services/homework_service.rb @@ -26,8 +26,9 @@ class HomeworkService state = @bid.comment_status #end open_anonymous_evaluation = @bid.open_anonymous_evaluation + jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') {:course_name => course.name,:course_id => course.id,:id => @bid.id, :author => @bid.author,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count, - :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_on,:deadline => @bid.deadline} + :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_on,:deadline => @bid.deadline,:jours => jours} end # 启动作业匿评前提示信息 From 199ef4ebe689ec593018b49f2df60b20eee20225 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 4 Mar 2015 17:14:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=88=97=E8=A1=A8=E8=A1=A5=E4=B8=8Acur=5Fpag?= =?UTF-8?q?e=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/anonymous_works_params.rb | 1 + app/services/homework_service.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/entities/anonymous_works_params.rb b/app/api/mobile/entities/anonymous_works_params.rb index 95cf9215d..e6bc8f346 100644 --- a/app/api/mobile/entities/anonymous_works_params.rb +++ b/app/api/mobile/entities/anonymous_works_params.rb @@ -15,6 +15,7 @@ module Mobile anonymous_works_params_expose :m_score anonymous_works_params_expose :is_anonymous_comments anonymous_works_params_expose :cur_type + anonymous_works_params_expose :cur_page expose :jours ,using: Mobile::Entities::Jours do |f, opt| if f.is_a?(Hash) && f.key?(:jours) f[:jours] diff --git a/app/services/homework_service.rb b/app/services/homework_service.rb index d69617eb5..f9be6f79d 100644 --- a/app/services/homework_service.rb +++ b/app/services/homework_service.rb @@ -117,7 +117,7 @@ class HomeworkService @is_anonymous_comments = @bid.comment_status == 1 && !@homework.users.include?(current_user) && @homework.user != current_user && !@is_teacher #判断是不是匿评(开启匿评,当前用户不是作业的创建者或者参与者,不是老师) jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据 #@jour = paginateHelper jours,5 #留言 - #@cur_page = params[:cur_page] || 1 + @cur_page = params[:cur_page] || 1 @cur_type = params[:cur_type] || 5 teacher_stars_json_like = stars_to_json_like(@teacher_stars,true,@homework,true) student_stars_json_like = stars_to_json_like(@student_stars,false,@homework,(false || @is_teacher)) @@ -126,7 +126,7 @@ class HomeworkService end [@homework,{:is_teacher => @is_teacher,:m_score => @m_score,:jours => jours,:teacher_stars => teacher_stars_json_like, - :student_stars => student_stars_json_like,:is_anonymous_comments => @is_anonymous_comments,:cur_type => @cur_type}] + :student_stars => student_stars_json_like,:is_anonymous_comments => @is_anonymous_comments,:cur_type => @cur_type,:cur_page => @cur_page}] #name = @homework.name #desc = @homework.description #datetime = @homework.created_at