From b121faea590bb77b7b466287cdaa4119b63ce198 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 13 Jan 2020 17:07:06 +0800 Subject: [PATCH 01/29] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/weapps/shared/_user.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/weapps/shared/_user.json.jbuilder b/app/views/weapps/shared/_user.json.jbuilder index be67384cc..53212ec15 100644 --- a/app/views/weapps/shared/_user.json.jbuilder +++ b/app/views/weapps/shared/_user.json.jbuilder @@ -7,6 +7,7 @@ json.admin user.admin? json.business user.business? json.is_teacher user.user_extension&.teacher? json.user_identity user.identity +json.identity user.user_extension&.identity json.tidding_count 0 json.user_phone_binded user.phone.present? json.phone user.phone From 0f822648408d4b4aaca4672be3874af05ebc36d2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 13 Jan 2020 17:18:23 +0800 Subject: [PATCH 02/29] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8F=91=E9=80=81?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weapps/verification_codes_controller.rb | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/controllers/weapps/verification_codes_controller.rb b/app/controllers/weapps/verification_codes_controller.rb index 7590c49f7..1876014db 100644 --- a/app/controllers/weapps/verification_codes_controller.rb +++ b/app/controllers/weapps/verification_codes_controller.rb @@ -19,11 +19,10 @@ class Weapps::VerificationCodesController < Weapps::BaseController return render_error('请输入正确的邮箱或手机号') end - code = %W(0 1 2 3 4 5 6 7 8 9) - verification_code = code.sample(6).join send_type = login =~ /^1\d{10}$/ ? 1 : 8 - # 记录验证码 - check_verification_code(verification_code, send_type, login) + + # 发送验证码 + send_code(send_type, login) render_ok end @@ -40,12 +39,21 @@ class Weapps::VerificationCodesController < Weapps::BaseController return render_error('请输入正确的邮箱或手机号') end + send_type = login =~ /^1\d{10}$/ ? 2 : 3 + + # 发送验证码 + send_code(send_type, login) + + render_ok + end + + def send_code send_type, login code = %W(0 1 2 3 4 5 6 7 8 9) verification_code = code.sample(6).join - send_type = login =~ /^1\d{10}$/ ? 2 : 3 # 记录验证码 - check_verification_code(verification_code, send_type, login) + sign = Digest::MD5.hexdigest("#{OPENKEY}#{login}") + tip_exception(501, "请求不合理") if sign != params[:smscode] - render_ok + check_verification_code(verification_code, send_type, login) end end \ No newline at end of file From 870f195f48db12fe139fe96ee4ce6a3f1a597e11 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 13 Jan 2020 17:41:00 +0800 Subject: [PATCH 03/29] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 -- app/services/git_service.rb | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9faa14593..e0639de3f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,8 +23,6 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign - Rails.logger.info("#####################request: #{request.headers}") - #Rails.logger.info("#####################type: #{request.type}") if !Rails.env.development? && EduSetting.get("host_name") != "https://test-newweb.educoder.net" Rails.logger.info("66666 #{params}") # suffix = request.url.split(".").last.split("?").first diff --git a/app/services/git_service.rb b/app/services/git_service.rb index eedac2595..2bfc7423c 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -64,7 +64,7 @@ class GitService end def parse_return(body) - logger.info("--uri_exec: .....res is #{body}") + #logger.info("--uri_exec: .....res is #{body}") content = JSON.parse(body) if content["code"] != 0 From 49fb413662b27cb2eb985698e2a88828a0e87e3a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 13 Jan 2020 17:42:27 +0800 Subject: [PATCH 04/29] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/helps_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/helps_controller.rb b/app/controllers/helps_controller.rb index 8d58663f6..12cc8b9b3 100644 --- a/app/controllers/helps_controller.rb +++ b/app/controllers/helps_controller.rb @@ -29,7 +29,7 @@ class HelpsController < ApplicationController content = "

[#{params[:question_kind]}]

#{params[:description]}" if params[:attachment_ids] params[:attachment_ids].each do |attachment_id| - content += "![](/api/attachments/#{attachment_id})↵" + content += "![](/api/attachments/#{attachment_id})\n" end end else From 57235bd5198565965586fec50165a72f832f7b37 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 13 Jan 2020 17:47:21 +0800 Subject: [PATCH 05/29] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/helps_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/helps_controller.rb b/app/controllers/helps_controller.rb index 12cc8b9b3..145ac1bec 100644 --- a/app/controllers/helps_controller.rb +++ b/app/controllers/helps_controller.rb @@ -26,7 +26,7 @@ class HelpsController < ApplicationController def feedback if params[:url].blank? - content = "

[#{params[:question_kind]}]

#{params[:description]}" + content = "

[#{params[:question_kind]}]

#{params[:description]}

" if params[:attachment_ids] params[:attachment_ids].each do |attachment_id| content += "![](/api/attachments/#{attachment_id})\n" From d1ec190180ce69fc41a3fc73d09f2fde32ca5171 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 13 Jan 2020 18:02:37 +0800 Subject: [PATCH 06/29] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/helps_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/helps_controller.rb b/app/controllers/helps_controller.rb index 145ac1bec..10a073684 100644 --- a/app/controllers/helps_controller.rb +++ b/app/controllers/helps_controller.rb @@ -26,14 +26,14 @@ class HelpsController < ApplicationController def feedback if params[:url].blank? - content = "

[#{params[:question_kind]}]

#{params[:description]}

" + content = "[#{params[:question_kind]}]
#{params[:description]}
" if params[:attachment_ids] params[:attachment_ids].each do |attachment_id| - content += "![](/api/attachments/#{attachment_id})\n" + content += "![](/api/attachments/#{attachment_id})
" end end else - content = "

[#{params[:question_kind]}]

问题页面网址:#{params[:url]}

#{params[:description]}" + content = "[#{params[:question_kind]}]
问题页面网址:#{params[:url]}
#{params[:description]}" end ActiveRecord::Base.transaction do From 1e93f7b6fcfaa276055944b0f08ebe3f83603ad4 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Mon, 13 Jan 2020 18:18:23 +0800 Subject: [PATCH 07/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A1=AB=E7=A9=BA?= =?UTF-8?q?=E9=A2=98=E7=9A=84=E6=A0=87=E5=87=86=E7=AD=94=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index eaeb458a3..f8fba93f5 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -188,7 +188,7 @@ module ExercisesHelper if ex_ordered all_user_answers = effictive_users.pluck(:answer_text) null_stand_choice.each_with_index do |s,index| - s_choice_text = null_stand_text[index] + s_choice_text = null_stand_text[index].to_s.strip.downcase user_count = 0 # user_count = user_count + effictive_users.where("exercise_choice_id = ? and answer_text = ?",s,s_choice_text).pluck(:user_id).uniq.size user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size From b1aa24c5068de92fdfb7458ebbc910c7adce26ac Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Mon, 13 Jan 2020 18:27:53 +0800 Subject: [PATCH 08/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A1=AB=E7=A9=BA?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index f8fba93f5..513f980d8 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -188,7 +188,7 @@ module ExercisesHelper if ex_ordered all_user_answers = effictive_users.pluck(:answer_text) null_stand_choice.each_with_index do |s,index| - s_choice_text = null_stand_text[index].to_s.strip.downcase + s_choice_text = null_stand_text[index].to_s.strip user_count = 0 # user_count = user_count + effictive_users.where("exercise_choice_id = ? and answer_text = ?",s,s_choice_text).pluck(:user_id).uniq.size user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size From 5e1d9acd80e30c4ad6d049859f379e3a827dc5a0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 10:49:49 +0800 Subject: [PATCH 09/29] 1 --- .../chinese_dictionary.txt | 1 - config/harmonious_dictionary/harmonious.hash | Bin 46347 -> 46320 bytes 2 files changed, 1 deletion(-) diff --git a/config/harmonious_dictionary/chinese_dictionary.txt b/config/harmonious_dictionary/chinese_dictionary.txt index ce247eb45..c65450d70 100644 --- a/config/harmonious_dictionary/chinese_dictionary.txt +++ b/config/harmonious_dictionary/chinese_dictionary.txt @@ -613,7 +613,6 @@ a级情片 大史纪 戴相龙 弹劾 -登辉 邓笑贫 迪里夏提 地下教会 diff --git a/config/harmonious_dictionary/harmonious.hash b/config/harmonious_dictionary/harmonious.hash index 456a8254b258a810b2e661f5130946a71a39a915..7dfcdc80b75aa38a14a1ef1e29a791c268dbe4ca 100644 GIT binary patch delta 21 ccmeBv#q{AN6DtcxHIw;9R=3X0X`M^80b2G54*&oF delta 25 hcmezHlBxR@6DtcxHIv0gR=3W{516Dkdv`9?1^|B(355Uv From 42c4a4f953ee8cb53301239616c5c8d7b55c57f2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 11:09:53 +0800 Subject: [PATCH 10/29] =?UTF-8?q?=E9=80=89=E7=94=A8=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E7=9A=84=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/shixun_search_service.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/services/shixun_search_service.rb b/app/services/shixun_search_service.rb index 32488a7c3..710910100 100644 --- a/app/services/shixun_search_service.rb +++ b/app/services/shixun_search_service.rb @@ -23,9 +23,10 @@ class ShixunSearchService < ApplicationService if User.current.admin? || User.current.business? || !User.current.school_id @shixuns = @shixuns.where(hidden: 0) else - none_shixun_ids = ShixunSchool.where("school_id != #{User.current.school_id}").pluck(:shixun_id) + shixun_ids = ShixunSchool.where(school_id: User.current.school_id).pluck(:shixun_id) + shixun_ids = shixun_ids.reject(&:blank?).length == 0 ? -1 : shixun_ids.join(",") - @shixuns = @shixuns.where.not(id: none_shixun_ids).where(hidden: 0, status: 2, public: 2).or(@shixuns.where(id: User.current.shixuns)) + @shixuns = @shixuns.where("use_scope = 1 or id in (#{shixun_ids})").unhidden.published.or(@shixuns.where(id: User.current.shixuns)) end end From 271dbe1cbd6e2812807a9da7b2c81a37ea20f483 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:39:08 +0800 Subject: [PATCH 11/29] 1 --- app/controllers/subjects_controller.rb | 21 +++++-------------- .../subjects/statistics_info.json.jbuilder | 2 ++ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 47863a3a0..cdd449858 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -458,22 +458,6 @@ class SubjectsController < ApplicationController end def statistics_info - # data = Subjects::DataStatisticService.new(@subject) - # Rails.logger.info("study_count: #{data.study_count}") - # Rails.logger.info("course_study_count: #{ data.course_study_count}") - # Rails.logger.info("passed_count: #{data.passed_count}") - # Rails.logger.info("course_used_count: #{data.course_used_count}") - # Rails.logger.info("school_used_count: #{data.school_used_count}") - - # data_1 = Subjects::CourseUsedInfoService.call(@subject) - # Rails.logger.info("study_count: #{data_1}") - - # data_2 = Subjects::ShixunUsedInfoService.call(@subject) - # Rails.logger.info("study_count: #{data_2}") - - # data_3 = Subjects::UserUsedInfoService.call(@subject) - # Rails.logger.info("study_count: #{data_3}") - @data = if params[:type] == "shixun_info" @subject.subject_shixun_infos @@ -481,7 +465,12 @@ class SubjectsController < ApplicationController @subject.subject_user_infos else @subject.subject_course_records + select_sql = "count(*) total, sum(course_count) course_count, sum(student_count) student_count, " + + "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" + @total = @subject.subject_course_records.select("select_sql") end + + @data_count = @data.count @data = paginate custom_sort(@data, params[:sort_by], params[:sort_direction]) end diff --git a/app/views/subjects/statistics_info.json.jbuilder b/app/views/subjects/statistics_info.json.jbuilder index b31e41b31..0881651a9 100644 --- a/app/views/subjects/statistics_info.json.jbuilder +++ b/app/views/subjects/statistics_info.json.jbuilder @@ -3,4 +3,6 @@ json.message "success" json.data do json.subject_info @subject.subject_record json.other_info @data + json.total_count @data_count + json.total @total end \ No newline at end of file From e2fa4112b85078db7d1842a6a4189713aef9ed7e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:39:51 +0800 Subject: [PATCH 12/29] 1 --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index cdd449858..cf1330125 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -467,7 +467,7 @@ class SubjectsController < ApplicationController @subject.subject_course_records select_sql = "count(*) total, sum(course_count) course_count, sum(student_count) student_count, " + "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" - @total = @subject.subject_course_records.select("select_sql") + @total = @subject.subject_course_records.select("select_sql").first end @data_count = @data.count From a7ea21e552020405b12c8b7ab6a5d16b00a1d504 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:40:43 +0800 Subject: [PATCH 13/29] 1 --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index cf1330125..676af6036 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -467,7 +467,7 @@ class SubjectsController < ApplicationController @subject.subject_course_records select_sql = "count(*) total, sum(course_count) course_count, sum(student_count) student_count, " + "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" - @total = @subject.subject_course_records.select("select_sql").first + @total = @subject.subject_course_records.select("#{select_sql}").first end @data_count = @data.count From 39ccb537294f55729fa3afc0e4d10c899d5d1624 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:43:07 +0800 Subject: [PATCH 14/29] 1 --- app/controllers/subjects_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 676af6036..47c4d6a60 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -464,10 +464,10 @@ class SubjectsController < ApplicationController elsif params[:type] == "user_info" @subject.subject_user_infos else - @subject.subject_course_records - select_sql = "count(*) total, sum(course_count) course_count, sum(student_count) student_count, " + + select_sql = "count(subject_course_records.*) total, sum(course_count) course_count, sum(student_count) student_count, " + "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" @total = @subject.subject_course_records.select("#{select_sql}").first + @subject.subject_course_records end @data_count = @data.count From 6e528448a6dff21fea21eed77b5d029368b95261 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:45:17 +0800 Subject: [PATCH 15/29] 1 --- app/controllers/subjects_controller.rb | 3 --- app/views/subjects/statistics_info.json.jbuilder | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 47c4d6a60..248371e63 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -464,9 +464,6 @@ class SubjectsController < ApplicationController elsif params[:type] == "user_info" @subject.subject_user_infos else - select_sql = "count(subject_course_records.*) total, sum(course_count) course_count, sum(student_count) student_count, " + - "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" - @total = @subject.subject_course_records.select("#{select_sql}").first @subject.subject_course_records end diff --git a/app/views/subjects/statistics_info.json.jbuilder b/app/views/subjects/statistics_info.json.jbuilder index 0881651a9..daa3a6b60 100644 --- a/app/views/subjects/statistics_info.json.jbuilder +++ b/app/views/subjects/statistics_info.json.jbuilder @@ -4,5 +4,5 @@ json.data do json.subject_info @subject.subject_record json.other_info @data json.total_count @data_count - json.total @total + # json.total @total end \ No newline at end of file From fff12c44ad607d92f979f6371ad7e36598368209 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:48:42 +0800 Subject: [PATCH 16/29] 1 --- app/controllers/subjects_controller.rb | 3 +++ app/views/subjects/statistics_info.json.jbuilder | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 248371e63..8e78706ed 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -464,6 +464,9 @@ class SubjectsController < ApplicationController elsif params[:type] == "user_info" @subject.subject_user_infos else + select_sql = "count(subject_course_records.id) total, sum(course_count) course_count, sum(student_count) student_count, " + + "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" + @total = @subject.subject_course_records.select("#{select_sql}").first @subject.subject_course_records end diff --git a/app/views/subjects/statistics_info.json.jbuilder b/app/views/subjects/statistics_info.json.jbuilder index daa3a6b60..0881651a9 100644 --- a/app/views/subjects/statistics_info.json.jbuilder +++ b/app/views/subjects/statistics_info.json.jbuilder @@ -4,5 +4,5 @@ json.data do json.subject_info @subject.subject_record json.other_info @data json.total_count @data_count - # json.total @total + json.total @total end \ No newline at end of file From 9b30ab55becb6983e9bf3ac179601c87e7d17e07 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:52:22 +0800 Subject: [PATCH 17/29] 1 --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 8e78706ed..3b1a6fc8b 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -466,7 +466,7 @@ class SubjectsController < ApplicationController else select_sql = "count(subject_course_records.id) total, sum(course_count) course_count, sum(student_count) student_count, " + "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" - @total = @subject.subject_course_records.select("#{select_sql}").first + @total = @subject.subject_course_records.select("#{select_sql}").first.except("id") @subject.subject_course_records end From ae032c8f675d4bf25ed06146a8f762d233f2e30b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:53:01 +0800 Subject: [PATCH 18/29] 1 --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 3b1a6fc8b..8e78706ed 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -466,7 +466,7 @@ class SubjectsController < ApplicationController else select_sql = "count(subject_course_records.id) total, sum(course_count) course_count, sum(student_count) student_count, " + "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" - @total = @subject.subject_course_records.select("#{select_sql}").first.except("id") + @total = @subject.subject_course_records.select("#{select_sql}").first @subject.subject_course_records end From 42174b1df60d4d6d7bbad49dcf3ca6adadc36b5c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 11:53:16 +0800 Subject: [PATCH 19/29] 1 --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 8e78706ed..ce7fc575c 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -464,7 +464,7 @@ class SubjectsController < ApplicationController elsif params[:type] == "user_info" @subject.subject_user_infos else - select_sql = "count(subject_course_records.id) total, sum(course_count) course_count, sum(student_count) student_count, " + + select_sql = "id, count(subject_course_records.id) total, sum(course_count) course_count, sum(student_count) student_count, " + "sum(choice_shixun_num) choice_shixun_num, sum(choice_shixun_frequency) choice_shixun_frequency" @total = @subject.subject_course_records.select("#{select_sql}").first @subject.subject_course_records From dc3a6026c715534f16099994a22046c87dbb5897 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 13:55:42 +0800 Subject: [PATCH 20/29] =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E5=A0=82=E7=BB=9F=E8=AE=A1bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index 707255866..8e18ae2ad 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -105,7 +105,7 @@ class CollegesController < ApplicationController @courses = paginate courses course_ids = @courses.map(&:id) - @student_count = StudentsForCourse.where(course_id: course_ids).group(:course_id).count + @student_count = CourseMember.where(course_id: course_ids, role: 4).group(:course_id).count @shixun_work_count = HomeworkCommon.where(homework_type: 4, course_id: course_ids).group(:course_id).count @attachment_count = Attachment.where(container_id: course_ids, container_type: 'Course').group(:container_id).count @message_count = Message.joins(:board).where(boards: { parent_id: 0, course_id: course_ids }).group('boards.course_id').count From 14f94b4eb981e94f640575b7717997b37496993b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 13:57:11 +0800 Subject: [PATCH 21/29] =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E5=A0=82=E7=BB=9F=E8=AE=A1bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index 8e18ae2ad..ee7b9c014 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -53,7 +53,7 @@ class CollegesController < ApplicationController homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id)) un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count shixun_work_count = homeworks.size - un_shixun_work_count - student_count = StudentsForCourse.where(:course_id => course_ids.map(&:id)).count + student_count = CourseMember.where(course_id: course_ids.map(&:id), role: 4).count myshixun_ids = StudentWork.select("myshixun_id").where("homework_common_id in (#{homeworks.map(&:id).join(',').strip == "" ? -1 : homeworks.map(&:id).join(',')}) and myshixun_id is not null") complete_myshixun = Myshixun.select("id").where(:status => 1, :id => myshixun_ids.map(&:myshixun_id)).size all_myshixun = Myshixun.select("id").where(:id => myshixun_ids.map(&:myshixun_id)).size From 5a107ad34e0b2b7f8f4a0b55c3b211e261e0f4d1 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 14:14:57 +0800 Subject: [PATCH 22/29] =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/shixun_search_service.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/services/shixun_search_service.rb b/app/services/shixun_search_service.rb index 710910100..32488a7c3 100644 --- a/app/services/shixun_search_service.rb +++ b/app/services/shixun_search_service.rb @@ -23,10 +23,9 @@ class ShixunSearchService < ApplicationService if User.current.admin? || User.current.business? || !User.current.school_id @shixuns = @shixuns.where(hidden: 0) else - shixun_ids = ShixunSchool.where(school_id: User.current.school_id).pluck(:shixun_id) - shixun_ids = shixun_ids.reject(&:blank?).length == 0 ? -1 : shixun_ids.join(",") + none_shixun_ids = ShixunSchool.where("school_id != #{User.current.school_id}").pluck(:shixun_id) - @shixuns = @shixuns.where("use_scope = 1 or id in (#{shixun_ids})").unhidden.published.or(@shixuns.where(id: User.current.shixuns)) + @shixuns = @shixuns.where.not(id: none_shixun_ids).where(hidden: 0, status: 2, public: 2).or(@shixuns.where(id: User.current.shixuns)) end end From ed84abf94def11844bb62b9b952fb8a515fe428e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 15:01:44 +0800 Subject: [PATCH 23/29] =?UTF-8?q?=E5=88=86=E7=8F=AD=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...00114062353_migrate_coures_member_group.rb | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 db/migrate/20200114062353_migrate_coures_member_group.rb diff --git a/db/migrate/20200114062353_migrate_coures_member_group.rb b/db/migrate/20200114062353_migrate_coures_member_group.rb new file mode 100644 index 000000000..4255bbe9b --- /dev/null +++ b/db/migrate/20200114062353_migrate_coures_member_group.rb @@ -0,0 +1,25 @@ +class MigrateCouresMemberGroup < ActiveRecord::Migration[5.2] + def change + course_ids = [377, 657, 715, 777, 973, 1093, 1131, 1180, 1309, 1920, 2037, 2346, 2354, 2493, 2752, 2920, 3000, + 3141, 3240, 3350, 3351, 3353, 3387, 3533, 3796] + + courses = Course.where(id: course_ids) + + courses.each do |course| + group_ids = course.course_groups.pluck(:id) + [0] + course.course_members.where.not(course_group_id: group_ids).each do |member| + if CourseGroup.where(course_id: course.id, name: member.course_group_name).exists? + new_group = CourseGroup.where(course_id: course.id, name: member.course_group_name).first + else + position = CourseGroup.where(course_id: course.id).order("position desc").first&.position.to_i + 1 + new_group = course.course_groups.create!(name: member.course_group_name, position: position) + course.exercise_group_settings.where(course_group_id: member.course_group_id).update_all(course_group_id: new_group.id) + course.attachment_group_settings.where(course_group_id: member.course_group_id).update_all(course_group_id: new_group.id) + HomeworkGroupReview.where(homework_common_id: course.homework_commons.pluck(:id)).where(course_group_id: member.course_group_id).update_all(course_group_id: new_group.id) + course.homework_group_settings.where(course_group_id: member.course_group_id).update_all(course_group_id: new_group.id) + end + member.update!(course_group_id: new_group.id) + end + end + end +end From 52ab6eb9e7bd01dc8419fc75a40e88d38abe6b52 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 15:22:41 +0800 Subject: [PATCH 24/29] =?UTF-8?q?=E5=88=86=E7=8F=AD=E7=9A=84position?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20200114062353_migrate_coures_member_group.rb | 4 ++-- ...0114071420_migrate_course_group_member_count.rb | 4 ++++ .../20200114071917_migrate_coure_group_position.rb | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20200114071420_migrate_course_group_member_count.rb create mode 100644 db/migrate/20200114071917_migrate_coure_group_position.rb diff --git a/db/migrate/20200114062353_migrate_coures_member_group.rb b/db/migrate/20200114062353_migrate_coures_member_group.rb index 4255bbe9b..b9992cb50 100644 --- a/db/migrate/20200114062353_migrate_coures_member_group.rb +++ b/db/migrate/20200114062353_migrate_coures_member_group.rb @@ -11,8 +11,8 @@ class MigrateCouresMemberGroup < ActiveRecord::Migration[5.2] if CourseGroup.where(course_id: course.id, name: member.course_group_name).exists? new_group = CourseGroup.where(course_id: course.id, name: member.course_group_name).first else - position = CourseGroup.where(course_id: course.id).order("position desc").first&.position.to_i + 1 - new_group = course.course_groups.create!(name: member.course_group_name, position: position) + # position = CourseGroup.where(course_id: course.id).order("position desc").first&.position.to_i + 1 + new_group = course.course_groups.create!(name: member.course_group_name) course.exercise_group_settings.where(course_group_id: member.course_group_id).update_all(course_group_id: new_group.id) course.attachment_group_settings.where(course_group_id: member.course_group_id).update_all(course_group_id: new_group.id) HomeworkGroupReview.where(homework_common_id: course.homework_commons.pluck(:id)).where(course_group_id: member.course_group_id).update_all(course_group_id: new_group.id) diff --git a/db/migrate/20200114071420_migrate_course_group_member_count.rb b/db/migrate/20200114071420_migrate_course_group_member_count.rb new file mode 100644 index 000000000..aad9dcc9c --- /dev/null +++ b/db/migrate/20200114071420_migrate_course_group_member_count.rb @@ -0,0 +1,4 @@ +class MigrateCourseGroupMemberCount < ActiveRecord::Migration[5.2] + def change + end +end diff --git a/db/migrate/20200114071917_migrate_coure_group_position.rb b/db/migrate/20200114071917_migrate_coure_group_position.rb new file mode 100644 index 000000000..0061eaad3 --- /dev/null +++ b/db/migrate/20200114071917_migrate_coure_group_position.rb @@ -0,0 +1,14 @@ +class MigrateCoureGroupPosition < ActiveRecord::Migration[5.2] + def change + course_ids = [377, 657, 715, 777, 973, 1093, 1131, 1180, 1309, 1920, 2037, 2346, 2354, 2493, 2752, 2920, 3000, + 3141, 3240, 3350, 3351, 3353, 3387, 3533, 3796] + + courses = Course.where(id: course_ids) + + courses.each do |course| + CourseGroup.where(coures_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index| + group.update!(position: index+1) + end + end + end +end From 34c5c550fa5e537b2f24306cb0627d3d11628a83 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 15:23:33 +0800 Subject: [PATCH 25/29] =?UTF-8?q?=E5=88=86=E7=8F=AD=E7=9A=84position?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20200114071917_migrate_coure_group_position.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20200114071917_migrate_coure_group_position.rb b/db/migrate/20200114071917_migrate_coure_group_position.rb index 0061eaad3..fc04e1bcb 100644 --- a/db/migrate/20200114071917_migrate_coure_group_position.rb +++ b/db/migrate/20200114071917_migrate_coure_group_position.rb @@ -6,7 +6,7 @@ class MigrateCoureGroupPosition < ActiveRecord::Migration[5.2] courses = Course.where(id: course_ids) courses.each do |course| - CourseGroup.where(coures_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index| + CourseGroup.where(course_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index| group.update!(position: index+1) end end From 72a48f6e6c22d576a67b3f18329eca397014c292 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 15:25:30 +0800 Subject: [PATCH 26/29] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=9A=84=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/shixun_search_service.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/services/shixun_search_service.rb b/app/services/shixun_search_service.rb index 32488a7c3..710910100 100644 --- a/app/services/shixun_search_service.rb +++ b/app/services/shixun_search_service.rb @@ -23,9 +23,10 @@ class ShixunSearchService < ApplicationService if User.current.admin? || User.current.business? || !User.current.school_id @shixuns = @shixuns.where(hidden: 0) else - none_shixun_ids = ShixunSchool.where("school_id != #{User.current.school_id}").pluck(:shixun_id) + shixun_ids = ShixunSchool.where(school_id: User.current.school_id).pluck(:shixun_id) + shixun_ids = shixun_ids.reject(&:blank?).length == 0 ? -1 : shixun_ids.join(",") - @shixuns = @shixuns.where.not(id: none_shixun_ids).where(hidden: 0, status: 2, public: 2).or(@shixuns.where(id: User.current.shixuns)) + @shixuns = @shixuns.where("use_scope = 1 or id in (#{shixun_ids})").unhidden.published.or(@shixuns.where(id: User.current.shixuns)) end end From 91a83784e097d35744e840d1a2cc6499cdbcd5db Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 15:27:04 +0800 Subject: [PATCH 27/29] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20200114071420_migrate_course_group_member_count.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/migrate/20200114071420_migrate_course_group_member_count.rb b/db/migrate/20200114071420_migrate_course_group_member_count.rb index aad9dcc9c..5273290f2 100644 --- a/db/migrate/20200114071420_migrate_course_group_member_count.rb +++ b/db/migrate/20200114071420_migrate_course_group_member_count.rb @@ -1,4 +1,8 @@ class MigrateCourseGroupMemberCount < ActiveRecord::Migration[5.2] def change + CourseGroup.reset_column_information + CourseGroup.find_each do |group| + CourseGroup.reset_counters(group.id, :course_members_count) + end end end From a4964802a3cf7a69602fe5b67d3af557ab179ebe Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 15:46:17 +0800 Subject: [PATCH 28/29] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/controllers/exercises_controller.rb | 2 +- app/controllers/graduation_tasks_controller.rb | 8 ++++---- app/controllers/polls_controller.rb | 2 +- app/services/update_homework_publish_setting_service.rb | 8 ++++---- .../20200114071420_migrate_course_group_member_count.rb | 8 -------- 6 files changed, 11 insertions(+), 19 deletions(-) delete mode 100644 db/migrate/20200114071420_migrate_course_group_member_count.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e0639de3f..fdb41c114 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,7 +23,7 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign - if !Rails.env.development? && EduSetting.get("host_name") != "https://test-newweb.educoder.net" + if !Rails.env.development? Rails.logger.info("66666 #{params}") # suffix = request.url.split(".").last.split("?").first # suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释 diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 5b555cf4c..44bfcf03f 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -402,7 +402,7 @@ class ExercisesController < ApplicationController if unified_setting || (course_group_ids.size == 0) tip_exception("发布时间不能为空") if params[:publish_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank? - tip_exception("截止时间不能早于发布时间") if params[:publish_time].to_time > params[:end_time].to_time + tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:end_time].to_time > @course.end_date.end_of_day params_publish_time = params[:publish_time].to_time diff --git a/app/controllers/graduation_tasks_controller.rb b/app/controllers/graduation_tasks_controller.rb index cac763344..6196aa5f5 100644 --- a/app/controllers/graduation_tasks_controller.rb +++ b/app/controllers/graduation_tasks_controller.rb @@ -384,11 +384,11 @@ class GraduationTasksController < ApplicationController if @task.status == 0 tip_exception("发布时间不能为空") if params[:publish_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank? - tip_exception("发布时间不能早于当前时间") if params[:publish_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S") - tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S") - tip_exception("截止时间不能早于发布时间") if params[:publish_time] > params[:end_time] + tip_exception("发布时间不能早于当前时间") if params[:publish_time].to_time <= Time.now + tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now + tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) + @course.end_date.present? && params[:end_time].to_time > @course.end_date.end_of_day @task.publish_time = params[:publish_time] @task.end_time = params[:end_time] diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index c9c9cc567..d320379be 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -724,7 +724,7 @@ class PollsController < ApplicationController if unified_setting || (course_group_ids.size == 0) tip_exception("发布时间不能为空") if params[:publish_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank? - tip_exception("截止时间不能早于发布时间") if params[:publish_time].to_time > params[:end_time].to_time + tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:end_time].to_time > @course.end_date.end_of_day diff --git a/app/services/update_homework_publish_setting_service.rb b/app/services/update_homework_publish_setting_service.rb index 69a68b613..61902cd80 100644 --- a/app/services/update_homework_publish_setting_service.rb +++ b/app/services/update_homework_publish_setting_service.rb @@ -15,11 +15,11 @@ class UpdateHomeworkPublishSettingService < ApplicationService if params[:unified_setting] || course.course_groups_count == 0 tip_exception("发布时间不能为空") if params[:publish_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank? - tip_exception("发布时间不能早于当前时间") if params[:publish_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S") - tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S") - tip_exception("截止时间不能早于发布时间") if params[:publish_time] > params[:end_time] + tip_exception("发布时间不能早于当前时间") if params[:publish_time].to_time <= Time.now + tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now + tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - course.end_date.present? && params[:end_time] > course.end_date.end_of_day + course.end_date.present? && params[:end_time].to_time > course.end_date.end_of_day homework.unified_setting = 1 homework.homework_group_settings.destroy_all diff --git a/db/migrate/20200114071420_migrate_course_group_member_count.rb b/db/migrate/20200114071420_migrate_course_group_member_count.rb deleted file mode 100644 index 5273290f2..000000000 --- a/db/migrate/20200114071420_migrate_course_group_member_count.rb +++ /dev/null @@ -1,8 +0,0 @@ -class MigrateCourseGroupMemberCount < ActiveRecord::Migration[5.2] - def change - CourseGroup.reset_column_information - CourseGroup.find_each do |group| - CourseGroup.reset_counters(group.id, :course_members_count) - end - end -end From 7dfb5076c718483caa9c34c089e6b12f233f7c11 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 14 Jan 2020 15:56:38 +0800 Subject: [PATCH 29/29] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=9A=84=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/shixun_search_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/shixun_search_service.rb b/app/services/shixun_search_service.rb index 710910100..8a99092cf 100644 --- a/app/services/shixun_search_service.rb +++ b/app/services/shixun_search_service.rb @@ -26,7 +26,7 @@ class ShixunSearchService < ApplicationService shixun_ids = ShixunSchool.where(school_id: User.current.school_id).pluck(:shixun_id) shixun_ids = shixun_ids.reject(&:blank?).length == 0 ? -1 : shixun_ids.join(",") - @shixuns = @shixuns.where("use_scope = 1 or id in (#{shixun_ids})").unhidden.published.or(@shixuns.where(id: User.current.shixuns)) + @shixuns = @shixuns.where("use_scope = 0 or id in (#{shixun_ids})").unhidden.published.or(@shixuns.where(id: User.current.shixuns)) end end