summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-05-22 17:50:53 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-05-22 17:50:53 +0200
commit65647a77cf355db5f8553669e8666eb5639ad689 (patch)
tree9bb88fca41ace0cfd7fe54f5fe9d50f7480f10ab
parent28316a2665f2c40b03a638e54dfdab925ccf4623 (diff)
Add support for per-problem initial code
-rw-r--r--js/codeq/problem_list.js1
-rw-r--r--js/codeq/prolog.js2
-rw-r--r--js/codeq/python.js2
-rw-r--r--js/codeq/robot.js2
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 <http://www.gnu.org/licenses/>. */
'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 <http://www.gnu.org/licenses/>. */
{
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 <http://www.gnu.org/licenses/>. */
{
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 <http://www.gnu.org/licenses/>. */
{
mode: 'python',
indentUnit: 4,
- value: currentSolution || ''
+ value: currentSolution || problemDef.initial || ''
},
function () {
jqBtnRun.focus();