Fix import of current day of week block from sb2.

This commit is contained in:
Karishma Chadha 2018-11-08 00:37:49 -05:00
parent 0e7eae98d5
commit 7d1226458f

View file

@ -297,6 +297,7 @@ const parseMonitorObject = (object, runtime, targets, extensions) => {
} else if (object.cmd === 'contentsOfList:') { } else if (object.cmd === 'contentsOfList:') {
block.id = getVariableId(object.param, Variable.LIST_TYPE); block.id = getVariableId(object.param, Variable.LIST_TYPE);
} else if (runtime.monitorBlockInfo.hasOwnProperty(block.opcode)) { } else if (runtime.monitorBlockInfo.hasOwnProperty(block.opcode)) {
if (object.param === 'day of week') object.param = 'DAYOFWEEK';
block.id = runtime.monitorBlockInfo[block.opcode].getId(target.id, [object.param]); block.id = runtime.monitorBlockInfo[block.opcode].getId(target.id, [object.param]);
} else { } else {
// If the opcode can't be found in the runtime monitorBlockInfo, // If the opcode can't be found in the runtime monitorBlockInfo,
@ -1028,6 +1029,10 @@ const parseBlock = function (sb2block, addBroadcastMsg, getVariableId, extension
value: providedArg value: providedArg
}; };
if (expectedArg.fieldName === 'CURRENTMENU' && providedArg === 'day of week') {
activeBlock.fields[expectedArg.fieldName].value = 'DAYOFWEEK';
}
if (expectedArg.fieldName === 'VARIABLE') { if (expectedArg.fieldName === 'VARIABLE') {
// Add `id` property to variable fields // Add `id` property to variable fields
activeBlock.fields[expectedArg.fieldName].id = getVariableId(providedArg, Variable.SCALAR_TYPE); activeBlock.fields[expectedArg.fieldName].id = getVariableId(providedArg, Variable.SCALAR_TYPE);