From f3434a1d005177a4ad457fcddac29bd3e5750871 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 20:07:29 +0800 Subject: [PATCH 01/12] 1 --- app/controllers/games_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 26a7ff8db..a0edd01c3 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -541,6 +541,8 @@ class GamesController < ApplicationController testSet << test_cases end + logger.info("##############testSet: #{testSet}") + testCases = Base64.urlsafe_encode64(testSet.to_json) unless testSet.blank? # 评测类型: 0,1,2 用于webssh的评测, 3用于vnc podType = @shixun.vnc_evaluate ? 3 : @shixun.webssh From 75c5b3425c0e8578fecbc8d3b7748f9e13c052cf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 20:20:20 +0800 Subject: [PATCH 02/12] 1 --- app/controllers/games_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index a0edd01c3..28ea599b1 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -564,6 +564,7 @@ class GamesController < ApplicationController # 私密仓库的设置 secret_rep = @shixun.shixun_secret_repository + logger.info("############secret_rep: #{secret_rep}") if secret_rep&.repo_name secretGitUrl = repo_url secret_rep.repo_path br_params.merge({secretGitUrl: secretGitUrl, secretDir: secret_rep.secret_dir_path}) From cd63277f3d6108a4963c51b436b0869fbcefe3f3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 20:23:26 +0800 Subject: [PATCH 03/12] 1 --- app/controllers/games_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 28ea599b1..434846ea1 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -566,7 +566,10 @@ class GamesController < ApplicationController secret_rep = @shixun.shixun_secret_repository logger.info("############secret_rep: #{secret_rep}") if secret_rep&.repo_name + logger.info("############repo_path: #{secret_rep.repo_path}") secretGitUrl = repo_url secret_rep.repo_path + logger.info("############secretGitUrl: #{secretGitUrl}") + logger.info("############secret_dir_path: #{secret_rep.secret_dir_path}") br_params.merge({secretGitUrl: secretGitUrl, secretDir: secret_rep.secret_dir_path}) end From 6b451e1200b66dd13b311a70324544ccdad7e807 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 20:24:21 +0800 Subject: [PATCH 04/12] 1 --- app/controllers/games_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 434846ea1..33a7b6fcb 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -566,11 +566,8 @@ class GamesController < ApplicationController secret_rep = @shixun.shixun_secret_repository logger.info("############secret_rep: #{secret_rep}") if secret_rep&.repo_name - logger.info("############repo_path: #{secret_rep.repo_path}") secretGitUrl = repo_url secret_rep.repo_path - logger.info("############secretGitUrl: #{secretGitUrl}") - logger.info("############secret_dir_path: #{secret_rep.secret_dir_path}") - br_params.merge({secretGitUrl: secretGitUrl, secretDir: secret_rep.secret_dir_path}) + br_params.merge!({secretGitUrl: secretGitUrl, secretDir: secret_rep.secret_dir_path}) end # 中间层交互 From f9eef7af3463886e3cb5dc86fdd26a53b8c0015e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 20:24:47 +0800 Subject: [PATCH 05/12] 1 --- app/controllers/games_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 33a7b6fcb..cb798b4c9 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -568,6 +568,7 @@ class GamesController < ApplicationController if secret_rep&.repo_name secretGitUrl = repo_url secret_rep.repo_path br_params.merge!({secretGitUrl: secretGitUrl, secretDir: secret_rep.secret_dir_path}) + logger.info("#######br_params:#{br_params}") end # 中间层交互 From 064acfc443575944129ba95e14b2b86153bc6ccb Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 20:37:38 +0800 Subject: [PATCH 06/12] 1 --- app/controllers/games_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index cb798b4c9..b35f2996f 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -567,7 +567,7 @@ class GamesController < ApplicationController logger.info("############secret_rep: #{secret_rep}") if secret_rep&.repo_name secretGitUrl = repo_url secret_rep.repo_path - br_params.merge!({secretGitUrl: secretGitUrl, secretDir: secret_rep.secret_dir_path}) + br_params.merge!({secretGitUrl: Base64.urlsafe_encode64(secretGitUrl), secretDir: secret_rep.secret_dir_path}) logger.info("#######br_params:#{br_params}") end From 83b29bc1d6030f9f3eee972e040adc4bca7eac61 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 21:00:17 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E5=8A=A0=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 3f415f706..24a11cb3b 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -479,6 +479,7 @@ class ShixunsController < ApplicationController else # 如果有仓库,就要删 if @shixun.shixun_secret_repository&.repo_name + @shixun.shixun_secret_repository.lock! GitService.delete_repository(repo_path: @shixun.shixun_secret_repository.repo_path) @shixun.shixun_secret_repository.destroy end From b96465c06d4c261363719d36a44964c263de42a5 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 9 Sep 2019 21:03:21 +0800 Subject: [PATCH 08/12] saving --- public/react/src/modules/tpm/TPMsettings/TPMsettings.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index 0887c4d18..a46654fe6 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -859,7 +859,8 @@ export default class TPMsettings extends Component { // }); // } submit_edit_shixun = () => { - + if (this.saving == true) return; + this.saving = true; if(this.state.status===-1){ this.props.showSnackbar("该实训已被删除,保存失败!"); return @@ -1002,6 +1003,7 @@ export default class TPMsettings extends Component { axios.put(Url, data).then((response) => { // console.log(response) + this.saving = false; if(response.status){ if (response.data.status === -1) { this.props.showSnackbar(response.data.message); @@ -1013,6 +1015,7 @@ export default class TPMsettings extends Component { }).catch((error) => { console.log(error) + this.saving = false; }) From 3a3a956ef7fe25ae65a64893134eeb63adbd9555 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 21:23:25 +0800 Subject: [PATCH 09/12] =?UTF-8?q?fork=E7=A7=81=E5=AF=86=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 24a11cb3b..8d735c25e 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -220,6 +220,16 @@ class ShixunsController < ApplicationController evaluate_script: @shixun.evaluate_script) end + # 同步私密版本库 + if @shixun.shixun_secret_repository + repo_name = "#{current_user.login}/secret_#{@shixun.identifier}" + secret_repo = "#{current_user.login}/secret_#{@new_shixun.identifier}" + ShixunSecretRepository.create!(shixun_id: @new_shixun.id, + repo_name: "#{repo_name}", + secret_dir_path: @shixun.secret_dir_path) + GitService.fork_repository(repo_path: "#{repo_name}.git", fork_repository_path: (secret_repo + ".git")) + end + # 同步镜像 if @shixun.mirror_repositories.present? @shixun.mirror_repositories.each do |mirror| From 641c6c4dddc682b12df49b267964b520012e9beb Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 21:24:51 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E7=A7=81=E5=AF=86=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E5=AE=9E=E8=AE=ADfork=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 8d735c25e..85b724ca9 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -223,11 +223,11 @@ class ShixunsController < ApplicationController # 同步私密版本库 if @shixun.shixun_secret_repository repo_name = "#{current_user.login}/secret_#{@shixun.identifier}" - secret_repo = "#{current_user.login}/secret_#{@new_shixun.identifier}" + fork_repository_name = "#{current_user.login}/secret_#{@new_shixun.identifier}" ShixunSecretRepository.create!(shixun_id: @new_shixun.id, repo_name: "#{repo_name}", secret_dir_path: @shixun.secret_dir_path) - GitService.fork_repository(repo_path: "#{repo_name}.git", fork_repository_path: (secret_repo + ".git")) + GitService.fork_repository(repo_path: "#{repo_name}.git", fork_repository_path: (fork_repository_name + ".git")) end # 同步镜像 From 8242a058abdac000b38d4579be301f009137b72b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Sep 2019 21:32:20 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 85b724ca9..5f69f1b91 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -226,7 +226,7 @@ class ShixunsController < ApplicationController fork_repository_name = "#{current_user.login}/secret_#{@new_shixun.identifier}" ShixunSecretRepository.create!(shixun_id: @new_shixun.id, repo_name: "#{repo_name}", - secret_dir_path: @shixun.secret_dir_path) + secret_dir_path: @shixun.shixun_secret_repository.secret_dir_path) GitService.fork_repository(repo_path: "#{repo_name}.git", fork_repository_path: (fork_repository_name + ".git")) end From 7493d798622e0e1de469a8b5cbd07f4fd4571ebd Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 9 Sep 2019 21:36:24 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_works_controller.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 6dcbea254..ab62cbd45 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -493,15 +493,16 @@ class StudentWorksController < ApplicationController # 删除实训作品评阅 def destroy_work_comment ActiveRecord::Base.transaction do - tip_exception("visible_comment参数有误") if params[:visible_comment].nil? + # tip_exception("visible_comment参数有误") if params[:visible_comment].nil? comment = @work.shixun_work_comments.find_by!(id: params[:comment_id]) - params[:visible_comment] ? comment.comment = nil : comment.hidden_comment = nil - if comment.comment.nil? && comment.hidden_comment.nil? - comment.destroy! - else - comment.save! - end + comment.destroy! + # params[:visible_comment] ? comment.comment = nil : comment.hidden_comment = nil + # if comment.comment.nil? && comment.hidden_comment.nil? + # comment.destroy! + # else + # comment.save! + # end normal_status("删除成功") end end