From 3ac9d7a7362ce06e031509ce355417d919399d4b Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 2 Apr 2019 17:31:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=AF=91=E5=A4=B1=E8=B4=A5=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/games_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 7f0e6df4..6d1f6410 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -151,6 +151,9 @@ class GamesService result = test_set.attributes.count > 4 ? test_set.try(:result) : nil #actual_output = Base64.encode64(actual_output) compile_success = (actual_output.blank? || actual_output.downcase.match(/error/).present?) ? 0 : 1 + + compile_success == 0 ? "编译失败,请在测试结果中查看具体的错误信息" : compile_success + public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result, :actual_output => actual_output, :compile_success => compile_success} # 测试集公开的话才返回input结果