From 2d8b5196b4a8d13c530f1a413a8181535495e98c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 7 Sep 2019 14:21:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/user/usersInfo/InfosTopics.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/InfosTopics.js b/public/react/src/modules/user/usersInfo/InfosTopics.js index db96818e5..5b344270e 100644 --- a/public/react/src/modules/user/usersInfo/InfosTopics.js +++ b/public/react/src/modules/user/usersInfo/InfosTopics.js @@ -70,6 +70,14 @@ class InfosTopics extends Component{ // }else{ // // } + + let types=this.props.match.params.topicstype; + let professional_certification=this.props.current_user&&this.props.current_user.professional_certification; + + + if(professional_certification===false&&types==="publicly"){ + + }else{ this.setState({ isSpin:true }) @@ -77,9 +85,9 @@ class InfosTopics extends Component{ let user_id=""; if(types==="publicly"){ - user_id=this.props.current_user&&this.props.current_user.login; + user_id=this.props.current_user&&this.props.current_user.login; }else{ - user_id=this.props.match.params&&this.props.match.params.username; + user_id=this.props.match.params&&this.props.match.params.username; } @@ -112,6 +120,8 @@ class InfosTopics extends Component{ }) }); + } + } searchCategory=(type)=>{ From 67395e72a7bea1b005375995a858542e87207aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 7 Sep 2019 14:22:13 +0800 Subject: [PATCH 2/3] =?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/src/modules/user/usersInfo/banks/BanksIndex.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js index e921022c3..121119a0d 100644 --- a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js +++ b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js @@ -127,7 +127,7 @@ class BanksIndex extends Component{ { crumbData && - { crumbData && crumbData.is_public == true ? '公共' : '我的' }题库 + { crumbData && crumbData.is_public == true ? '公共' : '我的' }题库 { crumbData.crumbArray && crumbData.crumbArray.map((item,key)=>{ return( From a7cfb3b078feb99b4416219864ee737c83ff46be Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 7 Sep 2019 14:22:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/question_banks_controller.rb | 2 +- .../20190907061918_migrate_bank_quotes.rb | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20190907061918_migrate_bank_quotes.rb diff --git a/app/controllers/users/question_banks_controller.rb b/app/controllers/users/question_banks_controller.rb index 76523eca4..5c8e69a29 100644 --- a/app/controllers/users/question_banks_controller.rb +++ b/app/controllers/users/question_banks_controller.rb @@ -30,7 +30,7 @@ class Users::QuestionBanksController < Users::BaseController .where(commit_status: 1, exercises: { exercise_bank_id: question_bank_ids }) .group('exercises.exercise_bank_id').count when 'poll' then - PollUser.joins(:poll).where(polls: { exercise_bank_id: question_bank_ids }) + PollUser.joins(:poll).where(commit_status: 1, polls: { exercise_bank_id: question_bank_ids }) .group('polls.exercise_bank_id').count when 'gtask' then GraduationWork.has_committed.joins(:graduation_task) diff --git a/db/migrate/20190907061918_migrate_bank_quotes.rb b/db/migrate/20190907061918_migrate_bank_quotes.rb new file mode 100644 index 000000000..34b2e53a1 --- /dev/null +++ b/db/migrate/20190907061918_migrate_bank_quotes.rb @@ -0,0 +1,23 @@ +class MigrateBankQuotes < ActiveRecord::Migration[5.2] + def change + HomeworkBank.all.each do |bank| + bank.update_column("quotes", bank.homework_commons.count) + end + + GtopicBank.all.each do |bank| + bank.update_column("quotes", bank.graduation_topics.count) + end + + GtaskBank.all.each do |bank| + bank.update_column("quotes", bank.graduation_tasks.count) + end + + ExerciseBank.all.each do |bank| + if bank.container_type == 'Exercise' + bank.update_column("quotes", bank.exercises.count) + elsif bank.container_type == 'Poll' + bank.update_column("quotes", bank.polls.count) + end + end + end +end