From 887171cf7e14c4fb7ed92dd5f9af01349a73dc41 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 10:53:31 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 17 +++++++++------ app/views/subjects/right_banner.json.jbuilder | 21 +++++++++++++++++++ app/views/subjects/show.json.jbuilder | 19 +---------------- config/routes.rb | 1 + 4 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 app/views/subjects/right_banner.json.jbuilder diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index ce2154fea..21c670b93 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -83,19 +83,24 @@ class SubjectsController < ApplicationController @is_creator = current_user.creator_of_subject?(@subject) @is_manager = @user.manager_of_subject?(@subject) # 合作团队 - @members = @subject.subject_members.includes(:user) @shixuns = @subject.shixuns.published.pluck(:id) - challenge_ids = Challenge.where(shixun_id: @shixuns).pluck(:id) + + # 访问数变更 + @subject.increment!(:visits) + end + + def right_banner + @user = current_user + # 合作团队 + @members = @subject.subject_members.includes(:user) + shixuns = @subject.shixuns.published.pluck(:id) + challenge_ids = Challenge.where(shixun_id: shixuns).pluck(:id) # 实训路径中的所有实训标签 @tags = ChallengeTag.where(challenge_id: challenge_ids).pluck(:name).uniq # 用户获取的实训标签 # @user_tags = @subject.shixuns.map(&:user_tags_name).flatten.uniq @user_tags = user_shixun_tags challenge_ids, @user.id @my_subject_progress = @subject.my_subject_progress - @challenge_count = challenge_ids.size - - # 访问数变更 - @subject.increment!(:visits) end def new diff --git a/app/views/subjects/right_banner.json.jbuilder b/app/views/subjects/right_banner.json.jbuilder new file mode 100644 index 000000000..9ca42c5bc --- /dev/null +++ b/app/views/subjects/right_banner.json.jbuilder @@ -0,0 +1,21 @@ + +json.members @members do |member| + json.partial! 'subject_member', locals: { user: member.user } + json.role member.role +end + +# 技能标签 +json.tags @tags do |tag| + unless tag.blank? + json.tag_name tag + json.status @user_tags.include?(tag) + end +end + +# 我的进展 +json.progress do + json.my_score @subject.my_subject_score + json.all_score @subject.all_score + json.learned @subject.my_subject_progress + json.time @subject.my_consume_time +end \ No newline at end of file diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder index dd4244a15..587a7eaa4 100644 --- a/app/views/subjects/show.json.jbuilder +++ b/app/views/subjects/show.json.jbuilder @@ -12,23 +12,6 @@ json.allow_send @user.logged? json.allow_visit @subject.status > 1 || @is_manager json.allow_add_member @is_manager -json.members @members do |member| - json.partial! 'subject_member', locals: { user: member.user } - json.role member.role -end +if @subject.excellent -# 技能标签 -json.tags @tags do |tag| - unless tag.blank? - json.tag_name tag - json.status @user_tags.include?(tag) - end -end - -# 我的进展 -json.progress do - json.my_score @subject.my_subject_score - json.all_score @subject.all_score - json.learned @subject.my_subject_progress - json.time @subject.my_consume_time end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 45690fbad..e797a0e7e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -273,6 +273,7 @@ Rails.application.routes.draw do delete :delete_member post :up_member_position post :down_member_position + get :right_banner end collection do From 0396d28ef9a94eca7e456c91196465b32295c09c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 11:32:15 +0800 Subject: [PATCH 02/11] =?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/controllers/subjects_controller.rb | 1 + app/helpers/subjects_helper.rb | 2 ++ app/views/subjects/show.json.jbuilder | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 21c670b93..b921eebb0 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -84,6 +84,7 @@ class SubjectsController < ApplicationController @is_manager = @user.manager_of_subject?(@subject) # 合作团队 @shixuns = @subject.shixuns.published.pluck(:id) + @courses = @subject.courses id if @subject.excellent # 访问数变更 @subject.increment!(:visits) diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb index 606f72587..e77af9cbb 100644 --- a/app/helpers/subjects_helper.rb +++ b/app/helpers/subjects_helper.rb @@ -16,4 +16,6 @@ module SubjectsHelper ChallengeTag.joins("join games on challenge_tags.challenge_id = games.challenge_id"). where(challenge_id: challenge_ids, games: {status: 2, user_id: user_id}).pluck("challenge_tags.name").uniq end + + end diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder index 587a7eaa4..2511fdadb 100644 --- a/app/views/subjects/show.json.jbuilder +++ b/app/views/subjects/show.json.jbuilder @@ -13,5 +13,11 @@ json.allow_visit @subject.status > 1 || @is_manager json.allow_add_member @is_manager if @subject.excellent - + @courses.each do |course| + json.start_date course.start_date.beginning_of_day + json.end_date course.end_date.end_of_day + json.student_count course.students.count + json.course_identity @user.course_identity(course) + json.course_status course + end end \ No newline at end of file From 48e06686eba94298d322291fbbf7934d771eeb7b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 14:59:51 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=87=91=E8=AF=BE=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- app/helpers/subjects_helper.rb | 15 ++++++++++++++- app/views/subjects/show.json.jbuilder | 12 +++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index b921eebb0..6a381b258 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -84,7 +84,7 @@ class SubjectsController < ApplicationController @is_manager = @user.manager_of_subject?(@subject) # 合作团队 @shixuns = @subject.shixuns.published.pluck(:id) - @courses = @subject.courses id if @subject.excellent + @courses = @subject.courses if @subject.excellent # 访问数变更 @subject.increment!(:visits) diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb index e77af9cbb..8aff41d25 100644 --- a/app/helpers/subjects_helper.rb +++ b/app/helpers/subjects_helper.rb @@ -17,5 +17,18 @@ module SubjectsHelper where(challenge_id: challenge_ids, games: {status: 2, user_id: user_id}).pluck("challenge_tags.name").uniq end - + # 金课的课堂状态 0:未开课,1:进行中,2:已结束 + def subject_course_status course + if course.is_end + {status: 2, time: ""} + elsif course.start_date && course.start_date > Date.today + {status: 0, time: ""} + elsif course.start_date && course.start_date <= Date.today && course.end_date >= Date.today + sum_week = ((course.end_date - course.start_date).to_i / 7.0).ceil + curr_week = ((Date.today - course.start_date).to_i / 7.0).ceil + {status: 1, time: "进行至第#{curr_week}周,共#{sum_week}周"} + else + {status: -1, time: ""} + end + end end diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder index 2511fdadb..bf179b86d 100644 --- a/app/views/subjects/show.json.jbuilder +++ b/app/views/subjects/show.json.jbuilder @@ -1,4 +1,4 @@ -json.(@subject, :id, :name, :description, :learning_notes, :stages_count, :stage_shixuns_count, :shixuns_count) +json.(@subject, :id, :name, :description, :learning_notes, :stages_count, :stage_shixuns_count, :shixuns_count, :excellent) json.challenge_choose_count @subject.subject_challenge_choose_count json.challenges_count @subject.subject_challenge_count @@ -13,11 +13,13 @@ json.allow_visit @subject.status > 1 || @is_manager json.allow_add_member @is_manager if @subject.excellent - @courses.each do |course| - json.start_date course.start_date.beginning_of_day - json.end_date course.end_date.end_of_day + json.courses @courses do |course| + json.course_id course.id + json.first_category_url module_url(course.none_hidden_course_modules.first, course) + json.start_date course.start_date + json.end_date course.end_date json.student_count course.students.count json.course_identity @user.course_identity(course) - json.course_status course + json.course_status subject_course_status course end end \ No newline at end of file From 3a1490f1c4a4c95c7120af62c44ea425e57e63db Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 15:47:59 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E5=BC=80=E5=90=AF=E6=8C=91=E6=88=98?= =?UTF-8?q?=E6=97=B6=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index fb999b879..343dd4b73 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -562,6 +562,17 @@ class ShixunsController < ApplicationController commit_id = commit["id"] end + # 如果该实训是金课中的实训,则将当前用户加入到当期开课的课堂 + if StageShixun.exists?(shixun_id: @shixun.id, subject_id: Subject.where(excellent: 1)) + subject = Subject.where(excellent: 1, id: StageShixun.where(shixun_id: @shixun.id).pluck(:subject_id)).take + if subject.courses.exists?("start_date is not null and start_date <= #{Date.today} and end_date is not null and end_date >= #{Date.today}") + course = subject.courses.where("start_date is not null and start_date <= #{Date.today} and end_date is not null and end_date >= #{Date.today}").take + unless CourseMember.exists?(course_id: course.id, user_id: current_user.id) + CourseMember.create!(course_id: course.id, user_id: current_user.id, role: 4) + end + end + end + ActiveRecord::Base.transaction do begin cloud_bridge = edu_setting('cloud_bridge') From d23f48dbc716f3af099ac3ea88f8cfaa35bd48f6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 17:10:54 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=97=B6=E8=87=AA=E5=8A=A8=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E8=AF=A5=E5=AE=9E=E8=AE=AD=E6=89=80=E5=9C=A8=E7=9A=84=E9=87=91?= =?UTF-8?q?=E8=AF=BE=E8=AF=BE=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 22 +++++++++++----------- dump.rdb | Bin 1888 -> 2086 bytes lib/tasks/publick_course.rake | 5 ++++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 343dd4b73..74942446e 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -555,21 +555,21 @@ class ShixunsController < ApplicationController # 判断实训是否全为选择题 is_choice_type = (min_challenges.size == min_challenges.select{|challenge| challenge.last == 1}.count) - if !is_choice_type - commit = GitService.commits(repo_path: @repo_path).try(:first) - uid_logger("First comit########{commit}") - tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? - commit_id = commit["id"] - end + # if !is_choice_type + # commit = GitService.commits(repo_path: @repo_path).try(:first) + # uid_logger("First comit########{commit}") + # tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? + # commit_id = commit["id"] + # end # 如果该实训是金课中的实训,则将当前用户加入到当期开课的课堂 if StageShixun.exists?(shixun_id: @shixun.id, subject_id: Subject.where(excellent: 1)) subject = Subject.where(excellent: 1, id: StageShixun.where(shixun_id: @shixun.id).pluck(:subject_id)).take - if subject.courses.exists?("start_date is not null and start_date <= #{Date.today} and end_date is not null and end_date >= #{Date.today}") - course = subject.courses.where("start_date is not null and start_date <= #{Date.today} and end_date is not null and end_date >= #{Date.today}").take - unless CourseMember.exists?(course_id: course.id, user_id: current_user.id) - CourseMember.create!(course_id: course.id, user_id: current_user.id, role: 4) - end + course = subject.courses.where("start_date is not null and start_date <= '#{Date.today}' and end_date is not null and end_date >= '#{Date.today}'").take + if course.present? && !CourseMember.exists?(course_id: course.id, user_id: current_user.id) + # 为了不影响后续操作,用create而不是create! + CourseMember.create(course_id: course.id, user_id: current_user.id, role: 4) + CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id]) end end diff --git a/dump.rdb b/dump.rdb index c4edd44ed9369cb224d86d4db8d9b1e4349f94f5..f7b65ded0f6f907e3c844f02d8fb1c6dbac91345 100644 GIT binary patch delta 694 zcmWN~y-So~008j!p7%by^U~9b2I=ngJS)xTdcHpb1EHj)2n?bj;`w@qz=TwyL2QT? zhl-bWrxq;?w}u31Y-p(6Uc`h5B51La`~!accKTj5o}+<{k27};dKTw{hqGaJ`_uf} zsW*ke%MWifTg^rk4fRD)PZUl4%L?G>s9{QL#{>-48ptH`P#cC|;Eo$CWlS(e**cgk z5{gvz1KeH~9DAn_HZmoKq?$>Cy`n5xIqe<=cOal#2sA~P!}3wBD#WL#dux=JB1d| ziszf4^R3r;j2uK*c*sUO{ZLaCpu}l#0(q&!ne1IW)SP~Ku2fVonI8j>TYzEx zp|rnV&ko|z)<`?w0&+8oUw#xkzbADYhiXSxfxTY>7K9D995bdq`9Tzzso`+6EHv9o2=yJ z0$>u4SIgP^VzU(aiNWL9*P^{NkfIbCCONdiIj%Hj=er~Ay(^XS%%Z&)+(L3I!n>gu jGaL}yj?_f0Qv-_FvHc5`%_pVLg`R=cXRm+0SZe$S$+Ez@ delta 473 zcmV~$&1w@t007|4%&=lp?-BJ$Mp4=)EjKy!ZlItKau}@o3>CKC}Mj*8SgeTbse7Nthgd{dh2Z z*I2rCaHErT+EKLJilQ`%hR0O{JndudH7+DYrQ{NEAqmn7b7V`SH46+9%5Aj|uEvC6 zQ~d&Wt3iDJ-tI;BDA;N65A1aH3K3FBLkN`vNr~nn--tHs_R)Nn8ZCBC{x$0NAfwDU zPq0InNRPP21R16SQltz{Vh@#Jd?l-%#~1pe7j+Aq!cq;CW|FJ=Gg)&ysnx_*NtHGr{05YqA2k}ctlLFBe>*| zrOG1jn0L+=lp48`&&Dad872?&JCJe1e)#6HW7-IdjVPG0TpDZx5o`1LZk;yTToFN8 z^(^To9WPO+-X_KHY>7)`xe}<5&IxS@S9si;jbVCwt5^?idg*aQW+85I5-_J!2a0 Date: Wed, 14 Aug 2019 17:50:10 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E9=87=91=E8=AF=BE=E5=89=8D=E4=B8=80?= =?UTF-8?q?=E5=A4=A9=E7=BB=99=E6=8A=A5=E5=90=8D=E8=80=85=E5=8F=91=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/public_course_notice.rake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/tasks/public_course_notice.rake diff --git a/lib/tasks/public_course_notice.rake b/lib/tasks/public_course_notice.rake new file mode 100644 index 000000000..461dae797 --- /dev/null +++ b/lib/tasks/public_course_notice.rake @@ -0,0 +1,19 @@ +desc "开放课程开课前通知报名用户" +namespace :public_course_notice do + task :tiding => :environment do + Course.where(excellent: 1).where("start_date is not null and start_date = '#{Date.today}'").each do |course| + attrs = %i[user_id trigger_user_id status container_id container_type belong_container_id + belong_container_type tiding_type created_at updated_at] + + same_attrs = { + trigger_user_id: 0, container_id: course.id, container_type: 'PublicCourseStart', + belong_container_id: course.id, belong_container_type: 'Course', tiding_type: 'System', status: 0 + } + Tiding.bulk_insert(*attrs) do |worker| + course.students.each do |student| + worker.add same_attrs.merge(user_id: student.user_id) + end + end + end + end +end \ No newline at end of file From ed11f16a9e504d58959f9076f186b1d90cb0bcdf Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 19:44:24 +0800 Subject: [PATCH 07/11] =?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/helpers/export_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 5d36c465f..433c5ae7d 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -147,7 +147,7 @@ module ExportHelper end w_7 = w.work_status == 0 ? '--' : myshixun.try(:passed_count).to_s+"/"+shixun.challenges_count.to_s w_8 = myshixun ? myshixun.try(:passed_time) == "--" ? "--" : format_time(myshixun.try(:passed_time)) : "--" # 通关时间 - w_9 = myshixun ? (myshixun.try(:passed_count) > 0 ? myshixun.total_spend_time : '--') : "--" #总耗时 + w_9 = myshixun ? (myshixun.try(:passed_count).to_i > 0 ? myshixun.total_spend_time : '--') : "--" #总耗时 w_10 = myshixun ? myshixun.output_times : 0 #评测次数 w_11 = myshixun ? myshixun.total_score : "--" #获得经验值 w_12 = w.final_score.present? ? w.final_score : 0 @@ -163,7 +163,7 @@ module ExportHelper end w_15 = w.work_score.nil? ? "--" : w.work_score.round(1) w_16 = w.update_time ? format_time(w.update_time) : "--" "更新时间" - w_17 = (game_spend_time w.cost_time) + w_17 = w.cost_time ? (game_spend_time w.cost_time) : "--" teacher_comments = w.student_works_scores if teacher_comments.present? w_18 = "" From ced52a49fd05c4394365effef731c3119156c54a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 19:46:37 +0800 Subject: [PATCH 08/11] =?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/helpers/export_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 433c5ae7d..5cefc062f 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -146,7 +146,7 @@ module ExportHelper w_6 = "--" end w_7 = w.work_status == 0 ? '--' : myshixun.try(:passed_count).to_s+"/"+shixun.challenges_count.to_s - w_8 = myshixun ? myshixun.try(:passed_time) == "--" ? "--" : format_time(myshixun.try(:passed_time)) : "--" # 通关时间 + w_8 = myshixun ? myshixun.try(:passed_time).to_s == "--" ? "--" : format_time(myshixun.try(:passed_time)) : "--" # 通关时间 w_9 = myshixun ? (myshixun.try(:passed_count).to_i > 0 ? myshixun.total_spend_time : '--') : "--" #总耗时 w_10 = myshixun ? myshixun.output_times : 0 #评测次数 w_11 = myshixun ? myshixun.total_score : "--" #获得经验值 From 50fd29fa6558635883f83323551df98491f16699 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 15 Aug 2019 11:00:09 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E5=BC=80=E8=AF=BE=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators/tiding_decorator.rb | 4 ++++ config/locales/tidings/zh-CN.yml | 1 + 2 files changed, 5 insertions(+) diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index ab9de4b76..81093dc12 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -380,4 +380,8 @@ module TidingDecorator I18n.t(locale_format(tiding_type)) % [container.try(:title) || extra] end end + + def public_course_start_content + I18n.t(locale_format) % [belong_container&.name, belong_container&.start_date&.strftime("%Y-%m-%d")] + end end diff --git a/config/locales/tidings/zh-CN.yml b/config/locales/tidings/zh-CN.yml index a4d213161..347b0139a 100644 --- a/config/locales/tidings/zh-CN.yml +++ b/config/locales/tidings/zh-CN.yml @@ -225,3 +225,4 @@ System: 1_end: "你提交的发布视频申请:%s,审核已通过" 2_end: "你提交的发布视频申请:%s,审核未通过
原因:%{reason}" + PublicCourseStart_end: "你报名参与的开放课程:%s,将于%s正式开课" From 977a770b41a315546bc71b590cf30ba6cb62f55a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 16 Aug 2019 09:45:02 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/excellent_course_exercise.rake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/tasks/excellent_course_exercise.rake diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake new file mode 100644 index 000000000..3546e48c3 --- /dev/null +++ b/lib/tasks/excellent_course_exercise.rake @@ -0,0 +1,19 @@ +#coding=utf-8 +# 执行示例 bundle exec rake excellent_course_exercise:student_answer args=149,2903 +desc "同步精品课的学生试卷数据" +namespace :excellent_course_exercise do + task :student_answer => :environment do + + course = Course.find_by(id: 2933) + exercises = course.exercises + + participant_count = 1042 + pass_count = 823 + + members_1 = course.students.order("id asc").limit(987) + members_2 = course.students.order("id asc").limit(1042) + members_1 = course.students.order("id asc").limit(322) + + + end +end \ No newline at end of file From 0c408581ae6126049a32cf6c2c6468e71f043a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 16 Aug 2019 10:36:56 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesLeftNav.js | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 282024b6d..b28472f66 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -680,22 +680,26 @@ class Coursesleftnav extends Component{ // course_modules:newcourse_modules // }) - if(result.source.droppableId==="shixun_homework"||result.source.droppableId==="graduation"||result.source.droppableId==="attachment"){ + if(result.source.droppableId==="shixun_homework"||result.source.droppableId==="graduation"||result.source.droppableId==="attachment"){ - let url ="/course_second_categories/"+result.draggableId+"/move_category.json" - this.droppablepost(url,result.destination.index+1) - - }else if(result.source.droppableId==="board"){ - - let url ="/boards/"+result.draggableId+"/move_category.json" - this.droppablepost(url,result.destination.index+1) + let url ="/course_second_categories/"+result.draggableId+"/move_category.json"; + if(result.destination.index!=null){ + this.droppablepost(url,result.destination.index+1) + } + }else if(result.source.droppableId==="board"){ - }else if(result.source.droppableId==="course_group"){ + let url ="/boards/"+result.draggableId+"/move_category.json"; + if(result.destination.index!=null) { + this.droppablepost(url, result.destination.index + 1) + } + }else if(result.source.droppableId==="course_group"){ if(result.draggableId!=1){ - let url ="/course_groups/"+result.draggableId+"/move_category.json" - this.droppablepost(url,result.destination.index+1) + let url ="/course_groups/"+result.draggableId+"/move_category.json"; + if(result.destination.index!=null) { + this.droppablepost(url, result.destination.index + 1) + } } - } + } }