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 1/2] =?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 From cac08350c681ff220d536b76430e047ddcbbcbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 7 Sep 2019 14:24:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E6=A0=8F=E7=9A=84=E5=8A=9F=E8=83=BD=E5=88=A0=E9=99=A4=E5=92=8C?= =?UTF-8?q?=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/gradinforms/Bullsubdirectory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js index d7a07f4d8..3e7522e31 100644 --- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -173,7 +173,7 @@ class Bullsubdirectory extends Component{ } var url = `/courses/${id}/update_informs.json`; axios.post(url,{ - inform_id:this.state.id, + inform_id:this.props.id, name:titname, description:values.description, }).then((result) => {