From ba152de10a2e7df5f1f1473fd42105c04e28801d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 16 Sep 2019 13:40:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=87=91=E8=AF=BE=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E4=BD=9C=E4=B8=9A=E6=95=B0=E6=8D=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/public_course_sync.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/public_course_sync.rake b/lib/tasks/public_course_sync.rake index a22a9f1f8..c26090e81 100644 --- a/lib/tasks/public_course_sync.rake +++ b/lib/tasks/public_course_sync.rake @@ -81,8 +81,10 @@ namespace :public_classes do homework.update_columns(publish_time: publish_time, end_time: end_time, created_at: created_at, updated_at: updated_at) homework.homework_detail_manual.update_columns(comment_status: 6, created_at: created_at, updated_at: updated_at) + homework.update_homework_work_score + homework.update_attribute('calculation_time', end_time) - homework.student_works.where("work_status !=0 and update_time > '#{end_time}'").update_all(update_time: end_time) + # homework.student_works.where("work_status !=0 and update_time > '#{end_time}'").update_all(update_time: end_time) end when 3 # 试卷 From 587bbab481f96840913f862b76ae2ab0a495bac4 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 16 Sep 2019 14:05:52 +0800 Subject: [PATCH 2/2] fix anonymous tiding show user avatar bug --- app/models/tiding.rb | 6 ++++++ app/views/tidings/_tiding.json.jbuilder | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/tiding.rb b/app/models/tiding.rb index d885f93fd..cdc149fe1 100644 --- a/app/models/tiding.rb +++ b/app/models/tiding.rb @@ -22,4 +22,10 @@ class Tiding < ApplicationRecord value end + + def anonymous? + (container_type == 'StudentWorksScore' && extra.to_i == 3) || + (container_type == 'StudentWorksScoresAppeal' && parent_container_type == 'AppealResult') || + (container_type == 'StudentWorksScoresAppeal' && parent_container_type == 'StudentWork' && tiding_type == 'System') + end end \ No newline at end of file diff --git a/app/views/tidings/_tiding.json.jbuilder b/app/views/tidings/_tiding.json.jbuilder index 959a96ebd..210e5c8f8 100644 --- a/app/views/tidings/_tiding.json.jbuilder +++ b/app/views/tidings/_tiding.json.jbuilder @@ -17,8 +17,13 @@ json.homework_type homework_type json.time tiding.how_long_time json.new_tiding tiding.unread?(@onclick_time) +# 需要系统头像 +show_system_user = tiding.trigger_user_id.zero? || + (tiding.trigger_user_id == 1 && tiding.tiding_type == 'System') || + tiding.anonymous? + json.trigger_user do - if tiding.trigger_user_id.zero? || (tiding.trigger_user_id == 1 && tiding.tiding_type == 'System') + if show_system_user json.id 0 json.name "系统" json.login ""