From 39cc6f83930107fb5034d3bc18bd668b1c0daf52 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Dec 2019 13:57:19 +0800 Subject: [PATCH 1/6] 1 --- app/views/shixuns/_top.json.jbuilder | 1 + config/routes.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/shixuns/_top.json.jbuilder b/app/views/shixuns/_top.json.jbuilder index ebb77ec74..358aae7f9 100644 --- a/app/views/shixuns/_top.json.jbuilder +++ b/app/views/shixuns/_top.json.jbuilder @@ -14,5 +14,6 @@ json.stu_num shixun.myshixuns_count json.experience shixun.all_score json.diffcult diff_to_s(shixun.trainee) json.score_info shixun.shixun_preference_info # todo: 这块可以改成只显示实训的平均分,不用每次都去取每种星的分数了。 +json.is_jupyter shixun.is_jupyter # 用于是否显示导航栏中的'背景知识' json.propaedeutics shixun.propaedeutics.present? diff --git a/config/routes.rb b/config/routes.rb index c3498adac..6888b5b2b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -749,7 +749,7 @@ Rails.application.routes.draw do resources :attachments do collection do - delete :destroy_files + post :destroy_files end end From 252025c13859e08648d436674a7fe316bc6cb671 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Dec 2019 13:59:22 +0800 Subject: [PATCH 2/6] 1 --- config/routes.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 6888b5b2b..364fba7b8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ Rails.application.routes.draw do get 'attachments/download/:id', to: 'attachments#show' get 'attachments/download/:id/:filename', to: 'attachments#show' + delete 'attachments/destroy_files', to 'attachments#destroy_files' get 'auth/qq/callback', to: 'oauth/qq#create' get 'auth/failure', to: 'oauth/base#auth_failure' @@ -747,11 +748,7 @@ Rails.application.routes.draw do resources :poll_bank_questions - resources :attachments do - collection do - post :destroy_files - end - end + resources :attachments resources :schools do member do From 6d72cb39f7341f3c67e007861a2559881aa5db29 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Dec 2019 13:59:41 +0800 Subject: [PATCH 3/6] 1 --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 364fba7b8..b1a96a6ea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ Rails.application.routes.draw do get 'attachments/download/:id', to: 'attachments#show' get 'attachments/download/:id/:filename', to: 'attachments#show' - delete 'attachments/destroy_files', to 'attachments#destroy_files' + delete 'api/attachments/destroy_files', to 'attachments#destroy_files' get 'auth/qq/callback', to: 'oauth/qq#create' get 'auth/failure', to: 'oauth/base#auth_failure' From 1debfd4b7b319bb56dbea28ea78d19be9e517193 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Dec 2019 14:04:03 +0800 Subject: [PATCH 4/6] 1 --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index b1a96a6ea..05f38449b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ Rails.application.routes.draw do get 'attachments/download/:id', to: 'attachments#show' get 'attachments/download/:id/:filename', to: 'attachments#show' - delete 'api/attachments/destroy_files', to 'attachments#destroy_files' + delete 'api/attachments/destroy_files', to: 'attachments#destroy_files' get 'auth/qq/callback', to: 'oauth/qq#create' get 'auth/failure', to: 'oauth/base#auth_failure' From a257a79093c6649d76afaf4abfd066f08730e123 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Dec 2019 14:07:39 +0800 Subject: [PATCH 5/6] 1 --- config/routes.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 05f38449b..c3498adac 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,6 @@ Rails.application.routes.draw do get 'attachments/download/:id', to: 'attachments#show' get 'attachments/download/:id/:filename', to: 'attachments#show' - delete 'api/attachments/destroy_files', to: 'attachments#destroy_files' get 'auth/qq/callback', to: 'oauth/qq#create' get 'auth/failure', to: 'oauth/base#auth_failure' @@ -748,7 +747,11 @@ Rails.application.routes.draw do resources :poll_bank_questions - resources :attachments + resources :attachments do + collection do + delete :destroy_files + end + end resources :schools do member do From 81129940031fb926fdbd0a9c48d0c1bf8b60683a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Dec 2019 14:30:46 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/searchable/shixun.rb | 3 ++- app/views/challenges/index.json.jbuilder | 1 + app/views/shixuns/_shixun.json.jbuilder | 1 + app/views/users/shixuns/shared/_shixun.json.jbuilder | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/searchable/shixun.rb b/app/models/searchable/shixun.rb index c574ecb1d..359b8b4dc 100644 --- a/app/models/searchable/shixun.rb +++ b/app/models/searchable/shixun.rb @@ -52,7 +52,8 @@ module Searchable::Shixun challenges_count: challenges_count, study_count: myshixuns_count, star: averge_star, - level: shixun_level + level: shixun_level, + is_jupyter: is_jupyter } end diff --git a/app/views/challenges/index.json.jbuilder b/app/views/challenges/index.json.jbuilder index 37ce94305..0b935cead 100644 --- a/app/views/challenges/index.json.jbuilder +++ b/app/views/challenges/index.json.jbuilder @@ -4,6 +4,7 @@ json.description @shixun.description json.power @editable json.shixun_identifier @shixun.identifier json.shixun_status @shixun.status +json.is_jupyter @shixun.is_jupyter? json.allow_skip @shixun.task_pass # 列表 diff --git a/app/views/shixuns/_shixun.json.jbuilder b/app/views/shixuns/_shixun.json.jbuilder index e6dbd3115..89e8d3c62 100644 --- a/app/views/shixuns/_shixun.json.jbuilder +++ b/app/views/shixuns/_shixun.json.jbuilder @@ -13,6 +13,7 @@ json.array! shixuns do |shixun| json.identifier shixun.identifier json.name shixun.name json.status shixun.status + json.is_jupyter shixun.is_jupyter? json.power (current_user.shixun_permission(shixun)) # 现在首页只显示已发布的实训 # REDO: 局部缓存 json.tag_name @tag_name_map&.fetch(shixun.id, nil) || shixun.tag_repertoires.first.try(:name) diff --git a/app/views/users/shixuns/shared/_shixun.json.jbuilder b/app/views/users/shixuns/shared/_shixun.json.jbuilder index 8427ead58..663522e53 100644 --- a/app/views/users/shixuns/shared/_shixun.json.jbuilder +++ b/app/views/users/shixuns/shared/_shixun.json.jbuilder @@ -6,4 +6,5 @@ json.name shixun.name json.status shixun.status json.human_status shixun.human_status json.challenges_count shixun.challenges_count -json.finished_challenges_count @finished_challenges_count_map&.fetch(shixun.id, 0) || shixun.finished_challenges_count(user) \ No newline at end of file +json.finished_challenges_count @finished_challenges_count_map&.fetch(shixun.id, 0) || shixun.finished_challenges_count(user) +json.is_jupyter shixun.is_jupyter \ No newline at end of file