From 622b4160d98e4848602ee3be6ecd78655447bc48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 29 Jul 2019 19:46:09 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/public/css/edu-all.css | 2 +- public/react/src/modules/tpm/NewHeader.js | 2 +- public/stylesheets/educoder/edu-all.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index 718ef291c..7de3c8152 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -15,7 +15,7 @@ text-align: center; height: 60px; box-sizing: border-box; - min-width: 800px; + min-width: 793px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 13313b5d4..3d1136371 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -791,7 +791,7 @@ submittojoinclass=(value)=>{ <%= link_to '注册', user_join_path, :className => "ml5" %> */} { user===undefined? - + this.educoderlogin()} className="mr5 color-white">登录 注册 diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index ff4665d22..730e9bab0 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -15,7 +15,7 @@ text-align: center; height: 60px; box-sizing: border-box; - min-width: 800px; + min-width: 793px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; From ef8f7bfc4ebc60c3f92a02852191ed6e76feca8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 29 Jul 2019 19:54:19 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/public/css/edu-all.css | 2 +- public/stylesheets/educoder/edu-all.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index 7de3c8152..8b7c727a9 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -15,7 +15,7 @@ text-align: center; height: 60px; box-sizing: border-box; - min-width: 793px; + min-width: 785px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 730e9bab0..4fdd8c400 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -15,7 +15,7 @@ text-align: center; height: 60px; box-sizing: border-box; - min-width: 793px; + min-width: 785px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; From 640adcedef3cbda9329454c415ca4ad98bd0a9ee Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 29 Jul 2019 20:26:24 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190729122213_delete_myshixun_games_for_users.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrate/20190729122213_delete_myshixun_games_for_users.rb diff --git a/db/migrate/20190729122213_delete_myshixun_games_for_users.rb b/db/migrate/20190729122213_delete_myshixun_games_for_users.rb new file mode 100644 index 000000000..9c93372e9 --- /dev/null +++ b/db/migrate/20190729122213_delete_myshixun_games_for_users.rb @@ -0,0 +1,11 @@ +class DeleteMyshixunGamesForUsers < ActiveRecord::Migration[5.2] + def change + myshixuns = Myshixun.where("created_at > '2019-07-26 19:00:00' and repo_name is null") + myshixuns.find_each do |m| + if m.games.count == m.games.select{|g| g.status == 3}.count + puts("#######login: #{User.find(m.user_id).login}") + myshixuns.destroy! + end + end + end +end From a38b598fa3c556641263c8ed52e92295bbc578da Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 29 Jul 2019 20:27:48 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20190729122213_delete_myshixun_games_for_users.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20190729122213_delete_myshixun_games_for_users.rb b/db/migrate/20190729122213_delete_myshixun_games_for_users.rb index 9c93372e9..d52369828 100644 --- a/db/migrate/20190729122213_delete_myshixun_games_for_users.rb +++ b/db/migrate/20190729122213_delete_myshixun_games_for_users.rb @@ -4,7 +4,7 @@ class DeleteMyshixunGamesForUsers < ActiveRecord::Migration[5.2] myshixuns.find_each do |m| if m.games.count == m.games.select{|g| g.status == 3}.count puts("#######login: #{User.find(m.user_id).login}") - myshixuns.destroy! + m.destroy! end end end From e734ecf78962f9cc214f025366fa5a11988fa23f Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 30 Jul 2019 09:14:39 +0800 Subject: [PATCH 5/7] fix tiding api --- app/controllers/tidings_controller.rb | 2 +- app/decorators/tiding_decorator.rb | 18 +++++++++++------- app/models/journal.rb | 3 +++ app/models/tiding.rb | 12 ++++++++++++ app/views/tidings/_tiding.json.jbuilder | 2 +- 5 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 app/models/journal.rb diff --git a/app/controllers/tidings_controller.rb b/app/controllers/tidings_controller.rb index 795010b3f..036de8868 100644 --- a/app/controllers/tidings_controller.rb +++ b/app/controllers/tidings_controller.rb @@ -20,7 +20,7 @@ class TidingsController < ApplicationController tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package' @count = tidings.count - @tidings = paginate(tidings.order(created_at: :desc), per_page: 10) + @tidings = paginate(tidings.order(created_at: :desc), per_page: 100) @onclick_time = current_user.click_time end diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index 8d383dadf..c9ad806ee 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -98,7 +98,7 @@ module TidingDecorator end def apply_add_schools_content - name = container.name + name = ApplyAddSchool.find_by(id: container_id)&.name if tiding_type == 'Apply' I18n.t(locale_format(tiding_type)) % name elsif status == 2 @@ -201,7 +201,7 @@ module TidingDecorator when 'Issue' then I18n.t(locale_format(parent_container_type)) % parent_container.subject when 'Journal' then - message = object.notes.present? ? ':' + message_content_helper(parent_container.notes) : '' + message = parent_container&.notes.present? ? ':' + message_content_helper(parent_container.notes) : '' I18n.t(locale_format(parent_container_type)) % message end end @@ -331,13 +331,17 @@ module TidingDecorator end def challenge_work_score_content + I18n.t(locale_format) % container&.comment + end + + def student_works_scores_appeal_content work = StudentWork.find_by(id: parent_container_id) - return if work.blank? + name = work&.homework_common&.name if parent_container_type == 'StudentWork' - I18n.t(locale_format(parent_container_type, tiding_type)) % work.homework_common.try(:name) - elsif parent_container_type == 'UserAppealResult' || parent_container_type == 'AppealResult' - I18n.t(locale_format(parent_container_type, status)) % work.homework_common.try(:name) + I18n.t(locale_format(parent_container_type, tiding_type)) % name + else + I18n.t(locale_format(parent_container_type, status)) % name end end @@ -349,7 +353,7 @@ module TidingDecorator if tiding_type == 'System' I18n.t(locale_format(tiding_type, status), reason: extra) % container.try(:title) else - I18n.t(locale_format) % container.try(:title) + I18n.t(locale_format(tiding_type)) % container.try(:title) end end diff --git a/app/models/journal.rb b/app/models/journal.rb new file mode 100644 index 000000000..d1a80af5f --- /dev/null +++ b/app/models/journal.rb @@ -0,0 +1,3 @@ +class Journal < ApplicationRecord + belongs_to :user +end \ No newline at end of file diff --git a/app/models/tiding.rb b/app/models/tiding.rb index 66b1f85be..3ef625c57 100644 --- a/app/models/tiding.rb +++ b/app/models/tiding.rb @@ -6,4 +6,16 @@ class Tiding < ApplicationRecord belongs_to :belong_container, polymorphic: true, optional: true has_many :attachments, as: :container + + def identifier + value = nil + if Object.const_defined?(container_type) + value = container.try(:identifier) + end + + if value.blank? && belong_container_type && Object.const_defined?(belong_container_type) + value = belong_container.try(:identifier) + end + value + 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 d26d37b7b..34b06320d 100644 --- a/app/views/tidings/_tiding.json.jbuilder +++ b/app/views/tidings/_tiding.json.jbuilder @@ -1,6 +1,6 @@ json.extract! tiding, :id, :status, :viewed, :user_id, :tiding_type, :container_id, :container_type, :parent_container_id, :parent_container_type json.content tiding.content -json.identifier tiding.try(:container).try(:identifier) rescue nil +json.identifier tiding.identifier json.time tiding.how_long_time json.new_tiding tiding.unread?(@onclick_time) From aed8cc0e3e55c26b5f52624103927ef0c80b0581 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 30 Jul 2019 09:18:08 +0800 Subject: [PATCH 6/7] modify tiding api per page --- app/controllers/tidings_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/tidings_controller.rb b/app/controllers/tidings_controller.rb index 036de8868..795010b3f 100644 --- a/app/controllers/tidings_controller.rb +++ b/app/controllers/tidings_controller.rb @@ -20,7 +20,7 @@ class TidingsController < ApplicationController tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package' @count = tidings.count - @tidings = paginate(tidings.order(created_at: :desc), per_page: 100) + @tidings = paginate(tidings.order(created_at: :desc), per_page: 10) @onclick_time = current_user.click_time end From 3f34af4ed03aac60dfa126a18b5aee385e014877 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 30 Jul 2019 09:24:20 +0800 Subject: [PATCH 7/7] fix tiding bug --- app/models/journal.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/journal.rb b/app/models/journal.rb index d1a80af5f..25c1e2498 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -1,3 +1,4 @@ class Journal < ApplicationRecord belongs_to :user + belongs_to :issue, foreign_key: :journalized_id end \ No newline at end of file