From 65647a77cf355db5f8553669e8666eb5639ad689 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 22 May 2016 17:50:53 +0200 Subject: Add support for per-problem initial code --- js/codeq/problem_list.js | 1 + js/codeq/prolog.js | 2 +- js/codeq/python.js | 2 +- js/codeq/robot.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/codeq/problem_list.js b/js/codeq/problem_list.js index a281afb..0070edb 100644 --- a/js/codeq/problem_list.js +++ b/js/codeq/problem_list.js @@ -363,6 +363,7 @@ along with this program. If not, see . */ 'problem': problem, 'id': rawData.id, 'translations': convertTranslations(rawTranslations, 'title', 'name', 'slug', 'description'), // GUI translations: keyword -> lang -> value + 'initial': rawData.initial, 'hint': processHints(rawTranslations), // hint translations: keyword -> lang -> value 'plan': processPlans(rawTranslations), // plan translations: keyword -> lang -> value 'hint_type': rawData.hint_type || {} diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index b0e8ebf..2c47bfb 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -167,7 +167,7 @@ along with this program. If not, see . */ { mode: 'prolog', indentUnit: 4, - value: currentSolution || '' + value: currentSolution || problemDef.initial || '' }, function () { jqTerminal.click(); diff --git a/js/codeq/python.js b/js/codeq/python.js index 3bc7ab5..d5138b4 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -111,7 +111,7 @@ along with this program. If not, see . */ { mode: 'python', indentUnit: 4, - value: currentSolution || '' + value: currentSolution || problemDef.initial || '' }, function () { jqTerminal.click() diff --git a/js/codeq/robot.js b/js/codeq/robot.js index bf9200f..1dd1fd6 100644 --- a/js/codeq/robot.js +++ b/js/codeq/robot.js @@ -86,7 +86,7 @@ along with this program. If not, see . */ { mode: 'python', indentUnit: 4, - value: currentSolution || '' + value: currentSolution || problemDef.initial || '' }, function () { jqBtnRun.focus(); -- cgit v1.2.1