Browse Source

Fix problem page error when datarule is invalid

pull/6/head
Menci 7 years ago
parent
commit
407b307336
  1. 4
      utility.js
  2. 4
      views/problem.ejs

4
utility.js

@ -278,8 +278,8 @@ module.exports = {
if (submitAnswer) testcase.answer = answer.replace('#', i);
if (!list.includes(testcase.input)) throw `找不到文件 ${testcase.input}`;
if (!list.includes(testcase.output)) throw `找不到文件 ${testcase.output}`;
if (testcase.input !== '-' && !list.includes(testcase.input)) throw `找不到文件 ${testcase.input}`;
if (testcase.output !== '-' && !list.includes(testcase.output)) throw `找不到文件 ${testcase.output}`;
res[s].cases.push(testcase);
}
}

4
views/problem.ejs

@ -54,7 +54,7 @@ if (contest) {
<% } %>
</div>
<div class="row" style="margin-top: -23px">
<span class="ui label">评测方式:<%= testcases ? (testcases.spj ? 'Special Judge' : '文本比较') : '无测试数据' %></span>
<span class="ui label">评测方式:<%= (testcases && !testcases.error) ? (testcases.spj ? 'Special Judge' : '文本比较') : '无测试数据' %></span>
<span class="ui label">题目类型:<%= { 'submit-answer': '答案提交', 'interaction': '交互', 'traditional': '传统' }[problem.type] %></span>
</div>
<div class="row" style="margin-top: -23px">
@ -197,7 +197,7 @@ if (contest) {
<% if (problem.type === 'submit-answer') { %>
<%
let cases = [];
if (testcases) {
if (testcases && !testcases.error) {
for (let subtasks of testcases) {
for (let testcase of subtasks.cases) {
cases.push(testcase.answer);

Loading…
Cancel
Save