diff --git a/static/src/js/app/admin/contest/contestList.js b/static/src/js/app/admin/contest/contestList.js index c0f30af1..cfaf664e 100644 --- a/static/src/js/app/admin/contest/contestList.js +++ b/static/src/js/app/admin/contest/contestList.js @@ -218,7 +218,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker", description: problem.description, time_limit: problem.time_limit, memory_limit: problem.memory_limit, - samples: problem.samples, + samples: [], test_case_id: problem.test_case_id, hint: problem.hint, source: problem.contest.title, @@ -228,6 +228,9 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker", output_description: problem.output_description, 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({ beforeSend: csrfTokenHeader, url: "/api/admin/problem/", @@ -333,4 +336,4 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker", }); avalon.scan(); -}); +}); \ No newline at end of file diff --git a/static/src/js/app/admin/problem/editProblem.js b/static/src/js/app/admin/problem/editProblem.js index 416d86fd..e3f235c4 100644 --- a/static/src/js/app/admin/problem/editProblem.js +++ b/static/src/js/app/admin/problem/editProblem.js @@ -77,20 +77,20 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE }); if (avalon.vmodels.editProblem) { var vm = avalon.vmodels.editProblem; - title: "", - description= ""; - timeLimit= -1; - memoryLimit= -1; - samples= []; - hint= ""; - visible= true; - difficulty= 0; - inputDescription= ""; - outputDescription= ""; - testCaseIdd= ""; - uploadSuccess= false; - source= ""; - testCaseList= []; + vm.title= "", + vm.description= ""; + vm.timeLimit= -1; + vm.memoryLimit= -1; + vm.samples= []; + vm.hint= ""; + vm.visible= true; + vm.difficulty= 0; + vm.inputDescription= ""; + vm.outputDescription= ""; + vm.testCaseIdd= ""; + vm.uploadSuccess= false; + vm.source= ""; + vm.testCaseList= []; } else var vm = avalon.define({