From f31d1a4c113add0b8e0050d4ccdff948a356e2ac Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 22 May 2019 10:19:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E5=A2=9E=E5=8A=A0=E5=88=9B?= =?UTF-8?q?=E5=BB=BApod=E5=92=8Cclone=E4=BB=A3=E7=A0=81=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 17 ++++++++++++++--- app/models/output.rb | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 09626c31..89ef1d84 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -467,7 +467,7 @@ class MyshixunsController < ApplicationController # taskId 即返回的game id # 返回结果:params [:stauts] 0 表示运行结果成功,其它则失败 - # compile_success 1 表示成功; 0表示失败 + # compile_success 1 表示成功; 0表示编译失败; -1 表示创建pod失败; -2 表示克隆代码失败 # msg 错误信息 # output 为测试用户编译输出结果 # myshixun:status 1为完成实训 @@ -475,7 +475,7 @@ class MyshixunsController < ApplicationController # resubmit 1:表示已通关后重新评测;0:表示非重新评测 # retry_status 0:初始值;1:重新评测失败;2:重新评测成功 # tpiRepoPath 中间层图片的workspace路径 - # params[:jsonTestDetails] = '{"buildID":"19284","compileSuccess":"1", + # params[:jsonTestDetails] = '{"buildID":"19284","compileSuccess":"1","createPodStatus": "1", "downloadStatus": "1", # "msg":[{"caseId":"1","expectedOutput":"MSAyIDMNCg","input":"MiAzIDE","output":"MSAyIDMNCg","passed":"1"}, # {"caseId":"2","expectedOutput":"LTMgMSA2DQo","input":"LTMgNiAx","output":"LTMgMSA2DQo","passed":"1"}, # {"caseId":"3","expectedOutput":"LTcgLTUgLTMNCg","input":"LTcgLTMgLTU","output":"LTcgLTUgLTMNCg","passed":"1"}], @@ -497,7 +497,18 @@ class MyshixunsController < ApplicationController resubmit = jsonTestDetails['resubmit'] outPut = tran_base64_decode64(jsonTestDetails['outPut']) jenkins_testsets = jsonTestDetails['msg'] - compile_success = jsonTestDetails['compileSuccess'] + # 创建pod的状态 0 失败 1 成功 + create_pod_status = jsonTestDetails['createPodStatus'] + # 克隆代码的装填 0 失败 1 成功 + clone_code_status = jsonTestDetails['downloadStatus'] + # 1表示编译成功;0 表示运行异常; -1 表示克隆代码失败; -2 表示创建pod失败 + compile_success = if clone_code_status == "0" + -1 + elsif create_pod_status == "0" + -2 + else + jsonTestDetails['compileSuccess'] + end # message = Base64.decode64(params[:msg]) unless params[:msg].blank? logger.info(outPut) game = Game.find(game_id) diff --git a/app/models/output.rb b/app/models/output.rb index 8f1547cf..aec0889d 100644 --- a/app/models/output.rb +++ b/app/models/output.rb @@ -1,7 +1,7 @@ class Output < ActiveRecord::Base # attr_accessible :title, :body # actual_output 编程题:实际输出, 选择题: 用户提交的答案(如: 014 对应用户选择为A B E) - # compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错! + # compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错! -1 表示克隆代码失败; -2 表示创建pod失败 default_scope :order => 'query_index desc' belongs_to :game #belongs_to :challenge_choose