From ce381b24d660a481fc16054d2f7d454234cea248 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 3 Jul 2019 18:05:18 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D/n=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 1b3349467..d28a42eb6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -407,7 +407,7 @@ class User < ApplicationRecord name = lastname + firstname name.blank? ? (nickname.blank? ? login : nickname) : name - name.gsub(/\s+/, '').strip #6.11 -hs + name.gsub(/\s+/, '').gsub(/\n/, '').strip #6.11 -hs end # 用户是否选题毕设课题 From 99d2c9478c2745262de93f99f9553f7982962ee9 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 3 Jul 2019 18:06:25 +0800 Subject: [PATCH 02/13] fixbug --- app/controllers/homework_commons_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index d49dac853..0ab3a6381 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -107,6 +107,8 @@ class HomeworkCommonsController < ApplicationController student_works = @homework.all_works @all_member_count = student_works.size + logger.info("###########______@homework.publish_time_________#{@homework.publish_time}") + if @homework.publish_time.nil? || (@homework.publish_time > Time.now) @student_works = [] if (params[:format] == "xlsx") || (params[:format] == "zip") From fa4e184a032b8fa4fcb3f68d8919451bc3c2ab63 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 3 Jul 2019 18:11:08 +0800 Subject: [PATCH 03/13] fix bug --- app/controllers/homework_commons_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 0ab3a6381..9780b4eec 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -109,7 +109,7 @@ class HomeworkCommonsController < ApplicationController logger.info("###########______@homework.publish_time_________#{@homework.publish_time}") - if @homework.publish_time.nil? || (@homework.publish_time > Time.now) + if @homework.publish_time.present? || (@homework.publish_time > Time.now) @student_works = [] if (params[:format] == "xlsx") || (params[:format] == "zip") normal_status(-1,"作业未发布") From d957d57b4b01de4d0574dc7063098633e88c2168 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 3 Jul 2019 18:11:11 +0800 Subject: [PATCH 04/13] add log --- app/models/user.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index d28a42eb6..ca8913526 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -406,8 +406,10 @@ class User < ApplicationRecord return '游客' unless logged? name = lastname + firstname - name.blank? ? (nickname.blank? ? login : nickname) : name - name.gsub(/\s+/, '').gsub(/\n/, '').strip #6.11 -hs + username = name.blank? ? (nickname.blank? ? login : nickname) : name + Rail.logger.info("3333333332222222#{username}") + username.gsub(/\s+/, '').gsub(/\n/, '').strip #6.11 -hs + end # 用户是否选题毕设课题 From 938190ef9bb549e17eb20f7fde933437493c65ad Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 3 Jul 2019 18:13:18 +0800 Subject: [PATCH 05/13] fix bug --- app/controllers/homework_commons_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 9780b4eec..9b77f8dc7 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -109,7 +109,7 @@ class HomeworkCommonsController < ApplicationController logger.info("###########______@homework.publish_time_________#{@homework.publish_time}") - if @homework.publish_time.present? || (@homework.publish_time > Time.now) + if @homework.publish_time.blank? || (@homework.publish_time > Time.now) @student_works = [] if (params[:format] == "xlsx") || (params[:format] == "zip") normal_status(-1,"作业未发布") From 6516908a5867fb84ed768135a723cca976f78e7c Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 3 Jul 2019 18:15:36 +0800 Subject: [PATCH 06/13] real name --- app/models/user.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index ca8913526..20b60dfcb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -404,12 +404,9 @@ class User < ApplicationRecord # 用户的真实姓名(不考虑用户是否隐藏了真实姓名,课堂模块都用真实姓名) def real_name return '游客' unless logged? - name = lastname + firstname - username = name.blank? ? (nickname.blank? ? login : nickname) : name - Rail.logger.info("3333333332222222#{username}") - username.gsub(/\s+/, '').gsub(/\n/, '').strip #6.11 -hs - + name.blank? ? (nickname.blank? ? login : nickname) : name + gsub(/\s+/, '').strip #6.11 -hs end # 用户是否选题毕设课题 From e071aeb556a0dd1bb643ea23ebc25db667e6c1b9 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 3 Jul 2019 18:17:44 +0800 Subject: [PATCH 07/13] .. --- app/controllers/myshixuns_controller.rb | 1 + app/models/user.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 3dfb739d0..fd75b7062 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -269,6 +269,7 @@ class MyshixunsController < ApplicationController author_name = current_user.full_name author_email = current_user.mail message = params[:evaluate] == 0 ? "System automatically submitted" : "User submitted" + uid_logger("") @content = GitService.update_file(repo_path: @repo_path, file_path: path, message: message, diff --git a/app/models/user.rb b/app/models/user.rb index 20b60dfcb..e775af5f8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -406,7 +406,7 @@ class User < ApplicationRecord return '游客' unless logged? name = lastname + firstname name.blank? ? (nickname.blank? ? login : nickname) : name - gsub(/\s+/, '').strip #6.11 -hs + name.gsub(/\s+/, '').strip #6.11 -hs end # 用户是否选题毕设课题 From ae1046632083dc4601738a210c525f1524ff95f3 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 3 Jul 2019 18:19:15 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0git=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index fd75b7062..2131eed9a 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -269,7 +269,8 @@ class MyshixunsController < ApplicationController author_name = current_user.full_name author_email = current_user.mail message = params[:evaluate] == 0 ? "System automatically submitted" : "User submitted" - uid_logger("") + uid_logger("112233#{author_name}") + uid_logger("112233#{author_email}") @content = GitService.update_file(repo_path: @repo_path, file_path: path, message: message, From d2f1a7a06b690ad30996ae74b7254c8234a20da9 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 3 Jul 2019 18:22:00 +0800 Subject: [PATCH 09/13] fix bug --- app/controllers/homework_commons_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 9b77f8dc7..5842d2522 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -108,8 +108,10 @@ class HomeworkCommonsController < ApplicationController @all_member_count = student_works.size logger.info("###########______@homework.publish_time_________#{@homework.publish_time}") + logger.info("-----------------------------------------------------") if @homework.publish_time.blank? || (@homework.publish_time > Time.now) + logger.info("+++++++++++++++++#{@homework.publish_time}") @student_works = [] if (params[:format] == "xlsx") || (params[:format] == "zip") normal_status(-1,"作业未发布") From 3fecc15aa7fc8c76cf3c708dc9bcb8a06d6dba65 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 3 Jul 2019 18:24:10 +0800 Subject: [PATCH 10/13] fix bug --- app/controllers/homework_commons_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 5842d2522..b25782026 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -114,6 +114,8 @@ class HomeworkCommonsController < ApplicationController logger.info("+++++++++++++++++#{@homework.publish_time}") @student_works = [] if (params[:format] == "xlsx") || (params[:format] == "zip") + logger.info("++++++params[:format]params[:format]params[:format]params[:format]+++++++++++#{params[:format]}") + normal_status(-1,"作业未发布") end else From cab3b87de3d311687998f9202c1a6899164dc1d8 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 3 Jul 2019 18:27:33 +0800 Subject: [PATCH 11/13] =?UTF-8?q?git=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8D=E6=88=90=E5=8A=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 2131eed9a..3abc71fd0 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -266,7 +266,7 @@ class MyshixunsController < ApplicationController if content != last_content @content_modified = 1 - author_name = current_user.full_name + author_name = current_user.real_name author_email = current_user.mail message = params[:evaluate] == 0 ? "System automatically submitted" : "User submitted" uid_logger("112233#{author_name}") From 5cdc8bb687ff3d7ad25b04b71e2a51138c4c8ae2 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Thu, 4 Jul 2019 09:00:28 +0800 Subject: [PATCH 12/13] =?UTF-8?q?xlsx=E5=AF=BC=E5=87=BA=E7=9A=84=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 6 ------ app/views/polls/commit_result.xlsx.axlsx | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index b25782026..519c05c62 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -107,15 +107,9 @@ class HomeworkCommonsController < ApplicationController student_works = @homework.all_works @all_member_count = student_works.size - logger.info("###########______@homework.publish_time_________#{@homework.publish_time}") - logger.info("-----------------------------------------------------") - if @homework.publish_time.blank? || (@homework.publish_time > Time.now) - logger.info("+++++++++++++++++#{@homework.publish_time}") @student_works = [] if (params[:format] == "xlsx") || (params[:format] == "zip") - logger.info("++++++params[:format]params[:format]params[:format]params[:format]+++++++++++#{params[:format]}") - normal_status(-1,"作业未发布") end else diff --git a/app/views/polls/commit_result.xlsx.axlsx b/app/views/polls/commit_result.xlsx.axlsx index 6ce00388c..aa7943d2a 100644 --- a/app/views/polls/commit_result.xlsx.axlsx +++ b/app/views/polls/commit_result.xlsx.axlsx @@ -49,7 +49,7 @@ wb.styles do |s| end #each_with_index sheet.add_row poll_users_info, :height =>15, :style => blue_cell - poll_users.each_with_index do |u,index| + poll_users.includes(user: :user_extension).each_with_index do |u,index| u_user = u.user user_answer_array = [] poll_questions.each do |q| From 2d6ed002d542530741e8bc206287dbc5e7dc1b06 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 4 Jul 2019 09:21:47 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E8=B0=83=E6=95=B4job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/exercise_publish_notify_job.rb | 2 +- app/jobs/homework_end_update_score_job.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/exercise_publish_notify_job.rb b/app/jobs/exercise_publish_notify_job.rb index f68a68c00..9c43b1978 100644 --- a/app/jobs/exercise_publish_notify_job.rb +++ b/app/jobs/exercise_publish_notify_job.rb @@ -31,7 +31,7 @@ class ExercisePublishNotifyJob < ApplicationJob Tiding.bulk_insert(*attrs) do |worker| teacher_ids = teachers.pluck(:user_id) unless exercise.tidings.exists?(parent_container_type: 'ExercisePublish', user_id: teacher_ids) - teacher_ids.find_each do |user_id| + teacher_ids.each do |user_id| worker.add same_attrs.merge(user_id: user_id) end end diff --git a/app/jobs/homework_end_update_score_job.rb b/app/jobs/homework_end_update_score_job.rb index ea6d3e5e3..e141fd758 100644 --- a/app/jobs/homework_end_update_score_job.rb +++ b/app/jobs/homework_end_update_score_job.rb @@ -2,7 +2,7 @@ class HomeworkEndUpdateScoreJob < ApplicationJob # 不允许补交的作业截止后,或者补交截止后需要重新计算一次作业成绩 queue_as :score - def perform(*args) + def perform(homework_id) homework = HomeworkCommon.find_by(id: homework_id) return if homework.blank? course = homework.course