Browse Source

Fix failed to parse submit answer problems' testdata

pull/6/head
Menci 7 years ago
parent
commit
98746e30de
  1. 10
      utility.js

10
utility.js

@ -258,16 +258,16 @@ module.exports = {
score: st.score, score: st.score,
type: st.type, type: st.type,
cases: st.cases.map(c => { cases: st.cases.map(c => {
function getFileName(template, id) { function getFileName(template, id, mustExist) {
let s = template.split('#').join(String(id)); let s = template.split('#').join(String(id));
if (!list.includes(s)) throw `找不到文件 ${s}`; if (mustExist && !list.includes(s)) throw `找不到文件 ${s}`;
return s; return s;
} }
let o = {}; let o = {};
if (input) o.input = getFileName(input, c); if (input) o.input = getFileName(input, c, true);
if (output) o.output = getFileName(output, c); if (output) o.output = getFileName(output, c, true);
if (answer) o.answer = getFileName(answer, c); if (answer) o.answer = getFileName(answer, c, false);
return o; return o;
}) })

Loading…
Cancel
Save