Skip to content

Commit 3d8d15a

Browse files
committed
Inconsistent state with multiple yellow nodes #576
1 parent 6212b1e commit 3d8d15a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

www/js/model.js

+19
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,11 @@ define([
14031403
update("schemas");
14041404
update("entity");
14051405
update("equation");
1406+
//in case slots are not yet corrected, return incorrect even if the equation status is demo, refer to topomath issue "Inconsistent state with multiple yellow nodes #576"
1407+
var slotsCorrected = this.areSlotsDemo(studentID);
1408+
if(bestStatus == "demo" && this.getStatus(studentID,"equation").status == "demo" && !slotsCorrected){
1409+
bestStatus = "incorrect";
1410+
}
14061411
}
14071412
if(bestStatus == "partial"){
14081413
bestStatus = "incorrect";
@@ -1484,6 +1489,20 @@ define([
14841489
var entityValid = entityStatusObj.status == "correct" || entityStatusObj.status == "demo";
14851490
return schemaValid && entityValid;
14861491
},
1492+
areSlotsDemo: function(nodeID){
1493+
var ret = false;
1494+
var statusObj = this.getNode(nodeID).status;
1495+
Object.keys(statusObj).some(function(key){
1496+
if(key!= "schemas" && key!= "entity" && key!= "description" && key!= "equation"){
1497+
console.log(key);
1498+
if(statusObj[key] == "demo"){
1499+
ret = true;
1500+
return true;
1501+
}
1502+
}
1503+
});
1504+
return ret;
1505+
},
14871506
getGreenScore: function(problemConditions){
14881507
//returns the percentage of the greens or stars from all the user solved nodes so far
14891508
//nodeDen is the denominator the score being computed. It comprises of all the nodes student attempted so far (which exludes given nodes)

0 commit comments

Comments
 (0)