From 8ff48585676a40abaf67f660dec3cc5aa6b3033b Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 19 Mar 2020 00:42:12 +0800 Subject: [PATCH 1/6] .. --- Gemfile | 3 +-- lib/tasks/sync_video.rake | 0 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 lib/tasks/sync_video.rake diff --git a/Gemfile b/Gemfile index 26767b091..f9d9e3c06 100644 --- a/Gemfile +++ b/Gemfile @@ -90,7 +90,6 @@ gem 'rails-i18n', '~> 5.1' # job gem 'sidekiq' gem 'sinatra' -gem "sidekiq-cron", "~> 1.1" # batch insert gem 'bulk_insert' @@ -113,4 +112,4 @@ gem 'request_store' # 敏感词汇 gem 'harmonious_dictionary', '~> 0.0.1' -gem 'parallel', '~> 1.19', '>= 1.19.1' +gem 'parallel', '~> 1.19', '>= 1.19.1' \ No newline at end of file diff --git a/lib/tasks/sync_video.rake b/lib/tasks/sync_video.rake new file mode 100644 index 000000000..e69de29bb From 223eedaedb62cbcaf10a821bab33be0e60ac65b9 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 19 Mar 2020 00:43:53 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=B8=8A=E7=BA=BF=E4=B8=8D=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/sidekiq.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 90dedac1b..b3f2d0576 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -1,5 +1,3 @@ -require 'sidekiq/web' -require 'sidekiq/cron/web' redis_config = Rails.application.config_for(:redis) sidekiq_url = redis_config["url"] @@ -10,9 +8,3 @@ end Sidekiq.configure_client do |config| config.redis = { url: sidekiq_url } end - -schedule_file = "config/schedule.yml" - -if File.exists?(schedule_file) && Sidekiq.server? - Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) -end \ No newline at end of file From 1c2deccd1425a677d9677b3a53da7cbe7d96e2b3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 19 Mar 2020 09:40:15 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=95=8F=E6=84=9F=E8=AF=8D=E6=B1=87?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chinese_dictionary.txt | 5 +---- config/harmonious_dictionary/harmonious.hash | Bin 46209 -> 46331 bytes 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/config/harmonious_dictionary/chinese_dictionary.txt b/config/harmonious_dictionary/chinese_dictionary.txt index 2bd91e8d2..fd7278dfc 100644 --- a/config/harmonious_dictionary/chinese_dictionary.txt +++ b/config/harmonious_dictionary/chinese_dictionary.txt @@ -518,7 +518,6 @@ H漫画 胡启立 芮杏文 杨白冰 -邹家华 谭绍文 王汉斌 任建新 @@ -1377,6 +1376,4 @@ B样 垃 圾 傻 逼 真蠢 -蠢猪 - - +蠢猪 \ No newline at end of file diff --git a/config/harmonious_dictionary/harmonious.hash b/config/harmonious_dictionary/harmonious.hash index 67e985d4c9cb4de4c6f9b4a21b7aa66fde07a2a5..8d906ec53549e61dc7b7f4f9340c5bba023062b2 100644 GIT binary patch delta 166 zcmZpC$@Kdr6DtcxHIwB=*2R%x?4C*-&zCi_Su=!Gvstr+0J$&LF5A35(n@2qK+^;c zMvln~yIh%HELgPpR@ZMeRt`@kHmAuKx}})d6eh=sN^JhRv4?5$19^GxdCg!$Kn6aY Yvk%EYHU$U=LxKZnDqQM$&nmbc0E8AG!``4&lR f{?RyrgOPo5XP4{dyIt?qfXuTSSY1|Qv)6O From eb67724fc56863542bc81c3e4c04ae6e8b73849e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 19 Mar 2020 15:36:27 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=85=B3=E5=8D=A1?= =?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/controllers/challenges_controller.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 762943183..44fa18f56 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -313,19 +313,27 @@ class ChallengesController < ApplicationController end rescue => e tip_exception("上移失败: #{e.message}") + raise ActiveRecord::Rollback end end def destroy next_challenges = @shixun.challenges.where("position > #{@challenge.position}") - next_challenges.update_all("position = position - 1") - # Todo: 实训修改后,关卡需要重置 - # shixun_modify_status_without_publish(@shixun, 1) - @challenge.destroy - # 关卡位置被删除,需要修改脚本 - script = modify_shixun_script @shixun, @shixun.evaluate_script - @shixun.shixun_info.update_column(:evaluate_script, script) + begin + ActiveRecord::Base.transaction do + next_challenges.update_all("position = position - 1") + # Todo: 实训修改后,关卡需要重置 + # shixun_modify_status_without_publish(@shixun, 1) + @challenge.destroy + # 关卡位置被删除,需要修改脚本 + script = modify_shixun_script @shixun, @shixun.evaluate_script + @shixun.shixun_info.update_column(:evaluate_script, script) + end + rescue => e + tip_exception("删除关卡失败: #{e.message}") + raise ActiveRecord::Rollback + end end From 016d59bcaad629cbc982e03e4b5922d73e1e41fc Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 19 Mar 2020 16:28:25 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E5=AD=A6=E7=94=9F=E4=BD=9C=E5=93=81=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/migrate_course_student_work.rake | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/tasks/migrate_course_student_work.rake diff --git a/lib/tasks/migrate_course_student_work.rake b/lib/tasks/migrate_course_student_work.rake new file mode 100644 index 000000000..c795a49ce --- /dev/null +++ b/lib/tasks/migrate_course_student_work.rake @@ -0,0 +1,31 @@ +# 执行示例 bundle exec rake migrate_course_student_work:homework args=2933 +desc "创建课堂学生的作业数据" + +namespace :migrate_course_student_work do + if ENV['args'] + course_id = ENV['args'].split(",")[0] # 对应课堂的id + end + + task homework: :environment do + course = Course.find_by(id: course_id) + if course.present? + student_ids = course.students.pluck(:user_id) + + # 如果之前存在相关作品,则更新is_delete字段 + student_works = StudentWork.joins(:homework_common).where(user_id: student_ids, homework_commons: {course_id: course.id}) + student_works.update_all(is_delete: 0) + + attrs = %i[homework_common_id user_id created_at updated_at] + + StudentWork.bulk_insert(*attrs) do |worker| + student_ids.each do |user_id| + same_attrs = {user_id: user_id} + course.homework_commons.where(homework_type: %i[normal group practice]).each do |homework| + next if StudentWork.where(user_id: user_id, homework_common_id: homework.id).any? + worker.add same_attrs.merge(homework_common_id: homework.id) + end + end + end + end + end +end From 481dff9e0642caad46f01b6d46667ee90a3d3e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 19 Mar 2020 17:34:55 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E9=97=AE=E5=8D=B7=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/poll/pollPublicBtn/ImmediatelyPublish.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js index f10474fdf..933ca1996 100644 --- a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js +++ b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js @@ -35,7 +35,8 @@ class Immediatelypublish extends Component{ modalsType:false, modalsTopval:"", loadtype:false, - chooseId:undefined + chooseId:undefined, + immediatelyopen:false } } //立即发布 @@ -73,6 +74,7 @@ class Immediatelypublish extends Component{ Saves:this.homeworkstartend, course_groups:response.data.course_groups, starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time, + immediatelyopen:response.data.course_groups===null||response.data.course_groups.length===0?false:true, }) } @@ -100,6 +102,7 @@ class Immediatelypublish extends Component{ Saves:this.homeworkstartend, course_groups:response.data.course_groups, starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time, + immediatelyopen:response.data.course_groups===null||response.data.course_groups.length===0?false:true, }) } }).catch((error) => { @@ -386,6 +389,7 @@ class Immediatelypublish extends Component{ starttimes={this.state.starttimes} starttimesend={this.state.starttimesend} typs={this.state.typs} + immediatelyopen={this.state.immediatelyopen} />:""} {/* 公用的提示弹框 */}