From 46c3e6e8f6ed947aae7ce4065718135b5af79c93 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 23 Sep 2016 14:16:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/activity.rb | 26 ++++++++++++++++++++++++++ app/api/mobile/entities/whomework.rb | 19 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index b36b8039b..b2581c319 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -109,6 +109,28 @@ module Mobile "项目" end end + when :homework_commit_count + if ac.act_type == "HomeworkCommon" + ac.act.student_works.has_committed.count + end + when :last_commit_info + if ac.act_type == "HomeworkCommon" + if ac.act.student_works.has_committed.count > 0 + lc = ac.act.student_works.has_committed.reorder("commit_time desc").first + {:lasttime=>time_from_now(lc.commit_time), :lastname=>lc.user.show_name} + end + end + when :last_score_info + if ac.act_type == "HomeworkCommon" + if ac.act.student_works.has_committed.count > 0 + sw_id = "("+ac.act.student_works.map{|sw| sw.id}.join(",")+")" + student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") + unless student_work_scores.empty? + last_score = student_work_scores.first + {:lasttime=>time_from_now(last_score.created_at), :lastname=>last_score.user.show_name} + end + end + end end end end @@ -153,6 +175,10 @@ module Mobile act_expose :course_project_name #课程/项目名字 act_expose :syllabus_title #课程名字 act_expose :activity_type_name #课程问答区/项目缺陷等 + act_expose :homework_commit_count #作品提交数 + act_expose :last_commit_info #最近提交信息 + act_expose :last_score_info #最近评阅信息 + expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options| if instance.act_type == "HomeworkCommon" || instance.act_type == "News" || instance.act_type == "Message" || instance.act_type == "BlogComment" || instance.act_type == "JournalsForMessage" || instance.act_type == "Issue" has_praise = false diff --git a/app/api/mobile/entities/whomework.rb b/app/api/mobile/entities/whomework.rb index b19d34f05..1fbc52eea 100644 --- a/app/api/mobile/entities/whomework.rb +++ b/app/api/mobile/entities/whomework.rb @@ -38,6 +38,22 @@ module Mobile wh.id when :title wh.name + when :homework_commit_count + wh.student_works.has_committed.count + when :last_commit_info + if wh.student_works.has_committed.count > 0 + lc = wh.student_works.has_committed.reorder("commit_time desc").first + {:lasttime=>time_from_now(lc.commit_time), :lastname=>lc.user.show_name} + end + when :last_score_info + if wh.student_works.has_committed.count > 0 + sw_id = "("+wh.student_works.map{|sw| sw.id}.join(",")+")" + student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") + unless student_work_scores.empty? + last_score = student_work_scores.first + {:lasttime=>time_from_now(last_score.created_at), :lastname=>last_score.user.show_name} + end + end end end end @@ -74,6 +90,9 @@ module Mobile whomework_expose :evaluation_end whomework_expose :praise_count whomework_expose :comment_count + whomework_expose :homework_commit_count #作品提交数 + whomework_expose :last_commit_info #最近提交信息 + whomework_expose :last_score_info #最近评阅信息 expose :all_children, using: Mobile::Entities::Jours do |f, opt| #f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages) if f.is_a?(::HomeworkCommon) From 56a55eb911e44bdf2437446a94ea9ef156643e79 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 23 Sep 2016 14:41:09 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=92=8C=E8=AF=A6=E6=83=85=E6=B7=BB=E5=8A=A0=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=95=B0=E5=8F=8A=E6=8F=90=E4=BA=A4=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 10 ++++++++++ public/assets/wechat/homework_detail.html | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 09490b766..6c42ef098 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -37,6 +37,11 @@
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} +
作品提交数: 10
+
+ #1个月前 胡莎莎 评阅了作品
+ #2个月前 胡莎莎 提交了作品 +
@@ -402,6 +407,11 @@
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} +
作品提交数: 10
+
+ #1个月前 胡莎莎 评阅了作品
+ #2个月前 胡莎莎 提交了作品 +
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 161c3be94..1806f9eb7 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -30,6 +30,11 @@ 缺评扣分:{{homework.absence_penalty}}分/作品 匿评关闭时间:{{homework.evaluation_end}}
+
作品提交数: 10
+
+ #1个月前 胡莎莎 评阅了作品
+ #2个月前 胡莎莎 提交了作品 +
From 60cce7c7818704bf2d2d9750c8d48a2fc2a139c8 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 23 Sep 2016 17:16:15 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E6=9C=80=E5=90=8E=E6=8F=90=E4=BA=A4=E5=8F=8A=E8=AF=84?= =?UTF-8?q?=E9=98=85=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 12 ++++++------ public/assets/wechat/homework_detail.html | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 6c42ef098..f80f44fb3 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -37,10 +37,10 @@
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} -
作品提交数: 10
+
作品提交数:{{act.homework_common_detail.homework_commit_count}}
- #1个月前 胡莎莎 评阅了作品
- #2个月前 胡莎莎 提交了作品 +
#{{act.homework_common_detail.last_commit_info.lasttime}} {{act.homework_common_detail.last_commit_info.lastname}} 提交了作品
+
#{{act.homework_common_detail.last_score_info.lasttime}} {{act.homework_common_detail.last_score_info.lastname}} 评阅了作品
@@ -407,10 +407,10 @@
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}} -
作品提交数: 10
+
作品提交数:{{act.homework_common_detail.homework_commit_count}}
- #1个月前 胡莎莎 评阅了作品
- #2个月前 胡莎莎 提交了作品 +
#{{act.homework_common_detail.last_commit_info.lasttime}} {{act.homework_common_detail.last_commit_info.lastname}} 提交了作品
+
#{{act.homework_common_detail.last_score_info.lasttime}} {{act.homework_common_detail.last_score_info.lastname}} 评阅了作品
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 1806f9eb7..e8e56126d 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -30,10 +30,10 @@ 缺评扣分:{{homework.absence_penalty}}分/作品 匿评关闭时间:{{homework.evaluation_end}}
-
作品提交数: 10
+
作品提交数:{{homework.homework_commit_count}}
- #1个月前 胡莎莎 评阅了作品
- #2个月前 胡莎莎 提交了作品 +
#{{homework.last_commit_info.lasttime}} {{homework.last_commit_info.lastname}} 提交了作品
+
#{{homework.last_score_info.lasttime}} {{homework.last_score_info.lastname}} 评阅了作品
From bd5a6b76f02ff66e392c992f33f0bf3f4d5c9a50 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 23 Sep 2016 17:46:35 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=9B=9E=E5=A4=8D=E7=99=BB=E5=BD=95=E5=90=8D?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/memos/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index bf1485cf3..3cd2ca9f3 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -89,7 +89,7 @@ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
<%= reply.author.name%><%= format_date(reply.created_at) %>
+
<%= reply.author.show_name%><%= format_date(reply.created_at) %>
<%= reply.content.gsub(/script/, "script ").html_safe %>