-
Notifications
You must be signed in to change notification settings - Fork 0
Inconsistent state with multiple yellow nodes #576 #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9c8caba
06bc2a7
a6c8cb9
3d8d15a
6d5891c
dae5310
1074942
7684986
e9bd24e
8f52639
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -198,7 +198,7 @@ define([ | |
|
|
||
| // A list of control map specific to students | ||
| resettableControls: ["equation"], | ||
| variableNodeControls: ["variable","value","units"], | ||
| variableNodeControls: ["variable","value","units","variableType"], | ||
| equationNodeControls: ["equation","schemas","entity"], | ||
| commonNodeControls: ["modelType","description"], | ||
| qtyElements: ["qtyDescriptionInputboxContainerStudent","variableTypeContainer","variableInputboxContainer", "unitsSelectorContainerStudent"], | ||
|
|
@@ -239,9 +239,8 @@ define([ | |
| units: "unitsSelectorStudent", | ||
| modelType: "modelSelector", | ||
| value: "valueInputbox", | ||
| unknown: "unknownType", | ||
| parameter: "parameterType", | ||
| dynamic: "dynamicType", | ||
| variableType: "variableType", | ||
| //dynamic: "dynamicType", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can delete this dynamic line too. |
||
| schemas: "schemaSelector", | ||
| entity: "entitySelectorStudent", | ||
| schemaDisplay: "schemaDescriptionQuestionMark", | ||
|
|
@@ -310,12 +309,12 @@ define([ | |
| // Log Error | ||
| //} | ||
| }, | ||
| handleVariableType: function(e){ | ||
| handleVariableType: function(varType){ | ||
| // Summary : Sets variableType to Unknown/Parameter/Dynamic | ||
| // Value is not allowed when variableType is Unknown | ||
| // Value is handled when variableType is parameter or dynamic. | ||
| console.log("********************* in handleVariableType"); | ||
| var _variableType = e.target.value; | ||
| var _variableType = varType; | ||
| this._model.student.setVariableType(this.currentID, _variableType); | ||
| this.variableTypeControls(this.currentID, _variableType); | ||
| this.applyDirectives(this._PM.processAnswer(this.currentID, 'variableType', _variableType)); | ||
|
|
@@ -505,6 +504,7 @@ define([ | |
| console.log("element",elem); | ||
| style.set(elem,"display","block"); | ||
| }); | ||
|
|
||
| //initially disable the type value and units which will be later handled in control settings based on state | ||
| this.disableTypeValueUnits(true); | ||
|
|
||
|
|
@@ -717,13 +717,24 @@ define([ | |
| style.set("unitsSelectorContainerStudent","display","none"); | ||
| } | ||
|
|
||
| /* | ||
| var prevSelected = query("input[name='variableType']:checked")[0] ? query("input[name='variableType']:checked")[0].value : undefined; | ||
| if(prevSelected) | ||
| registry.byId(prevSelected+"Type").set('checked', false); | ||
| registry.byId(prevSelected+"Type").set('checked', false); */ | ||
| var varTypeSel = registry.byId(this.controlMap.variableType); | ||
| varTypeSel.removeOption(varTypeSel.getOptions()); | ||
| var varTypes = ["unknown","parameter","dynamic"]; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove "dynamic" here. |
||
| //var curVarType = this._model.student.getVariableType(nodeid); | ||
| if(!varType){ | ||
| varTypeSel.addOption({label: "---Select---", value: "defaultValue"}); | ||
| } | ||
| array.forEach(varTypes, function(unit){ | ||
| varTypeSel.addOption({label: unit, value: unit}); | ||
| }); | ||
| if(varType){ | ||
| registry.byId(varType+"Type").set('checked', true); | ||
| this.variableTypeControls(this.currentID, varType); | ||
| } | ||
| varTypeSel.set('value', varType); | ||
| } | ||
| this.variableTypeControls(this.currentID, varType); | ||
| this.applyDirectives(nodeDirectives); | ||
| registry.byId(this.controlMap.variable).set("disabled",false); | ||
| } | ||
|
|
@@ -1015,18 +1026,18 @@ define([ | |
| updateVariableTypeValue: function(value){ | ||
| if(value == "unknown") | ||
| this._model.student.setValue(this.currentID, ""); | ||
| registry.byId(value+"Type").set("checked", "checked"); | ||
| registry.byId(this.controlMap.variableType).set('value', value); | ||
| this._model.student.setVariableType(this.currentID, value); | ||
| }, | ||
|
|
||
| updateVariableTypeStatus: function(attribute, value){ | ||
| if(attribute === "disabled" && value === true){ | ||
| array.forEach(this._variableTypes, function(type){ | ||
| registry.byId(type+"Type").set("disabled", true); | ||
| }); | ||
| //array.forEach(this._variableTypes, function(type){ | ||
| registry.byId(this.controlMap.variableType).set("disabled", true); | ||
| //}); | ||
| } else if(attribute === "status"){ | ||
| var selectedVariableType = query("input[name='variableType']:checked")[0].value; | ||
| registry.byId(selectedVariableType+"Type").set(attribute, value); | ||
| //var selectedVariableType = query("input[name='variableType']:checked")[0].value; | ||
| registry.byId(this.controlMap.variableType).set(attribute, value); | ||
| } | ||
| }, | ||
| handleEquationDescription: function(description){ | ||
|
|
@@ -1073,9 +1084,11 @@ define([ | |
| disableTypeValueUnits: function(disable){ | ||
| registry.byId(this.controlMap.value).set("disabled", disable); | ||
| registry.byId(this.controlMap.units).set("disabled", disable); | ||
| registry.byId(this.controlMap.variableType).set("disabled", disable); | ||
| /* | ||
| registry.byId(this.controlMap.unknown).set("disabled", disable); | ||
| registry.byId(this.controlMap.parameter).set("disabled", disable); | ||
| registry.byId(this.controlMap.dynamic).set("disabled", disable); | ||
| registry.byId(this.controlMap.dynamic).set("disabled", disable); */ | ||
| }, | ||
| getSlotVariablesList: function(){ | ||
| return this._model.student.getAllVariables(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,7 +90,7 @@ define([ | |
| // Controls that are select menus | ||
| // note that topomath author design has been updated, so updating selects and equationButtons array | ||
| //selects: ['description', 'units', 'inputs'], | ||
| selects: ['description', 'units'], | ||
| selects: ['description', 'units', 'variableType'], | ||
|
|
||
| //equationButtons: ["plus", "minus", "times", "divide", "equals", "undo", "equationDone"], | ||
| equationButtons: [], | ||
|
|
@@ -205,6 +205,7 @@ define([ | |
| Previously, just set domNode.bgcolor but this approach didn't work | ||
| for text boxes. */ | ||
| // console.log(">>>>>>>>>>>>> setting color ", this.domNode.id, " to ", value); | ||
| /* | ||
| if(this.domNode && this.domNode.firstChild && | ||
| (this.domNode.firstChild.name == "variableType" || | ||
| this.domNode.name == "variableType")){ | ||
|
|
@@ -213,9 +214,8 @@ define([ | |
| updateColor(registry.byId(type+"Type").domNode.firstChild.labels[0], ""); | ||
| }); | ||
| updateColor(this.domNode.firstChild.labels[0], colorMap[value]); | ||
| } else { | ||
| updateColor(this.domNode, colorMap[value]); | ||
| } | ||
| } else { */ | ||
| updateColor(this.domNode, colorMap[value]); | ||
| }, | ||
|
|
||
| hideCloseNodeEditor: function(/* originical hide method*/ doHide){ | ||
|
|
@@ -503,16 +503,22 @@ define([ | |
| return this.disableHandlers || this.handleEquationDescription.apply(this, arguments); | ||
| })); | ||
|
|
||
| //event handler for new variable type select field | ||
| var varTypeSel = registry.byId(this.controlMap.variableType); | ||
| varTypeSel.on('Change', lang.hitch(this, function(){ | ||
| return this.disableHandlers || this.handleVariableType.apply(this, arguments); | ||
| })); | ||
| /* | ||
| * event handler for 'value' field | ||
| * 'handleValue' will be called in either Student or Author mode | ||
| * */ | ||
| var variableTypeToggle = dojo.query(".handleVariable"); | ||
| /* | ||
| var variableTypeToggle = dojo.query(".handleVariable"); | ||
| variableTypeToggle.forEach(function(toggleNode){ | ||
| registry.byNode(toggleNode).on('click', lang.hitch(this, function(event){ | ||
| return this.disableHandlers || this.handleVariableType(event); | ||
| })); | ||
| }, this); | ||
| }, this); */ | ||
|
|
||
| var valueWidget = registry.byId(this.controlMap.value); | ||
| // This event gets fired if student hits TAB or input box | ||
|
|
@@ -718,11 +724,12 @@ define([ | |
|
|
||
| // reset the variablte type radio button labels | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned before, you can go ahead and remove the radio button code. |
||
| if(this.nodeType == "quantity"){ | ||
| /* | ||
| array.forEach(this._variableTypes, function(type){ | ||
| var w = registry.byId(type+"Type") | ||
| w.set("status", ""); | ||
| w.set("disabled", false); | ||
| }); | ||
| });*/ | ||
| } | ||
|
|
||
| for(control in this.genericDivMap) | ||
|
|
@@ -800,6 +807,9 @@ define([ | |
| // Initial input in Units box | ||
| registry.byId(this.controlMap.units).set('value', unit || ''); | ||
|
|
||
| var varType = model.getVariableType(nodeid); | ||
| registry.byId(this.controlMap.variableType).set('value', varType || ''); | ||
|
|
||
| } | ||
| else if(this.nodeType == "equation"){ | ||
| //populate nodeEditor fields for an equation node | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go ahead and delete the code for this. We can always retrieve it from git if we need it later.