From e5f78de16fe7a3f18aee2264ec0d15127b07d3ad Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 29 May 2019 12:17:05 +0200 Subject: [PATCH] Default Code Text --- Globals.js | 1 + .../Workspace/FunctionLibraries/PartsFromNodes.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Globals.js b/Globals.js index 2377c57ae..ada8e2e55 100644 --- a/Globals.js +++ b/Globals.js @@ -135,6 +135,7 @@ if (testUser !== null) { } const DEFAULT_FORMULA_TEXT = '// Write your formula here' +const DEFAULT_CODE_TEXT = '// Write your code here' const USDT_BTC_HTH = 19900; // This is needed to know the scale of the market time line. diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index e3719beac..9c6e13e5a 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -409,7 +409,9 @@ function newPartsFromNodes () { function addCode (node) { if (node.code === undefined) { - node.code = {} + node.code = { + code: DEFAULT_CODE_TEXT + } createPart('Code', '', node.code, node, node) } } @@ -453,7 +455,9 @@ function newPartsFromNodes () { let m = situation.conditions.length let condition = { name: 'New Condition', - code: {} + code: { + code: DEFAULT_CODE_TEXT + } } situation.conditions.push(condition) createPart('Condition', condition.name, condition, situation, situation, 'Condition')