From e8364e416821c090bcca03577a6624db11f2fe4a Mon Sep 17 00:00:00 2001 From: Menci Date: Mon, 28 Nov 2016 15:42:13 +0800 Subject: [PATCH] Show compiler output when compile error --- models/judge_state.js | 2 +- views/judge_detail.ejs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/models/judge_state.js b/models/judge_state.js index 0fad90d..3737da9 100644 --- a/models/judge_state.js +++ b/models/judge_state.js @@ -93,7 +93,7 @@ class JudgeState extends Model { score: 0, status: 'Waiting', - result: '{ "status": "Waiting", "total_time": 0, "total_memory": 0, "score": 0, "case_num": 0 }' + result: '{ "status": "Waiting", "total_time": 0, "total_memory": 0, "score": 0, "case_num": 0, "compiler_output": "" }' }, val))); } diff --git a/views/judge_detail.ejs b/views/judge_detail.ejs index 930432c..7f669b8 100644 --- a/views/judge_detail.ejs +++ b/views/judge_detail.ejs @@ -26,6 +26,10 @@
<%- judge.code %>
+<% if (judge.result.compiler_output && judge.result.status === 'Compile Error') { %> +

编译信息

+
<%= judge.result.compiler_output %>
+<% } else { %>
<% for (let i = 0; i < judge.result.case_num; i++) { %> <% let testcase = judge.result[i]; %> @@ -51,6 +55,7 @@
<% } %> +<% } %>