修复"公开比赛题目时多出样例数据的问题"

This commit is contained in:
sxw 2015-09-23 19:37:47 +08:00
commit 2e9f517723
2 changed files with 19 additions and 16 deletions

View File

@ -218,7 +218,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker",
description: problem.description, description: problem.description,
time_limit: problem.time_limit, time_limit: problem.time_limit,
memory_limit: problem.memory_limit, memory_limit: problem.memory_limit,
samples: problem.samples, samples: [],
test_case_id: problem.test_case_id, test_case_id: problem.test_case_id,
hint: problem.hint, hint: problem.hint,
source: problem.contest.title, source: problem.contest.title,
@ -228,6 +228,9 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker",
output_description: problem.output_description, output_description: problem.output_description,
difficulty: 0 difficulty: 0
}; };
for (var i = 0; i < problem.samples.length; i++) {
ajaxData.samples.push({input: problem.samples[i].input, output: problem.samples[i].output})
}
$.ajax({ $.ajax({
beforeSend: csrfTokenHeader, beforeSend: csrfTokenHeader,
url: "/api/admin/problem/", url: "/api/admin/problem/",

View File

@ -77,20 +77,20 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
}); });
if (avalon.vmodels.editProblem) { if (avalon.vmodels.editProblem) {
var vm = avalon.vmodels.editProblem; var vm = avalon.vmodels.editProblem;
title: "", vm.title= "",
description= ""; vm.description= "";
timeLimit= -1; vm.timeLimit= -1;
memoryLimit= -1; vm.memoryLimit= -1;
samples= []; vm.samples= [];
hint= ""; vm.hint= "";
visible= true; vm.visible= true;
difficulty= 0; vm.difficulty= 0;
inputDescription= ""; vm.inputDescription= "";
outputDescription= ""; vm.outputDescription= "";
testCaseIdd= ""; vm.testCaseIdd= "";
uploadSuccess= false; vm.uploadSuccess= false;
source= ""; vm.source= "";
testCaseList= []; vm.testCaseList= [];
} }
else else
var vm = avalon.define({ var vm = avalon.define({