Merge branch 'staging' into fix/transfer-advanced-bonfires

pull/6078/head
Quincy Larson 2016-01-13 00:10:28 -06:00
commit 2c90f2350b
6 changed files with 19 additions and 10 deletions

View File

@ -73,7 +73,7 @@ $(document).ready(function() {
}
common.codeStorage.updateStorage(challengeName, originalCode);
common.codeUri.querify(originalCode);
common.updateOutputDisplay('' + output);
common.updateOutputDisplay(output);
},
(err) => {
if (err) {
@ -107,7 +107,7 @@ $(document).ready(function() {
}
return common.updateOutputDisplay('' + err);
}
common.updateOutputDisplay('' + output);
common.updateOutputDisplay(output);
common.displayTestResults(tests);
if (solved) {
common.showCompletion();

View File

@ -38,11 +38,13 @@ window.common = (function(global) {
codeOutput.setSize('100%', '100%');
common.updateOutputDisplay = function updateOutputDisplay(str = '') {
str = JSON.stringify(str);
codeOutput.setValue(str);
return str;
};
common.appendToOutputDisplay = function appendToOutputDisplay(str = '') {
str = JSON.stringify(str);
codeOutput.setValue(codeOutput.getValue() + str);
return str;
};

View File

@ -104,7 +104,7 @@
"assert.deepEqual(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]).sort(), [1, 4, 5], 'message: <code>sym([1, 2, 5], [2, 3, 5], [3, 4, 5])</code> should return <code>[1, 4, 5]</code>');",
"assert.deepEqual(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]).sort(), [1, 4, 5], 'message: <code>sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5])</code> should return <code>[1, 4, 5]</code>.');",
"assert.deepEqual(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]).sort(), [2, 3, 4, 6, 7], 'message: <code>sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3])</code> should return <code>[7, 4, 6, 2, 3]</code>.');",
"assert.deepEqual(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]).sort(), [1, 2, 4, 5, 6, 7, 8, 9], 'message: <code>sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1])</code> should return <code>[1, 2, 5, 6, 7, 8, 9]</code>')"
"assert.deepEqual(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]).sort(), [1, 2, 4, 5, 6, 7, 8, 9], 'message: <code>sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1])</code> should return <code>[1, 2, 4, 5, 6, 7, 8, 9]</code>')"
],
"MDNlinks": [
"Array.reduce()",

View File

@ -576,7 +576,7 @@
""
],
"tail": [
"(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);"
"(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = \" + c; })(a,b,c);"
],
"solutions": [
"var a = 3;\nvar b = 17;\nvar c = 12;\n\na += 12;\nb += 9;\nc += 7;"
@ -617,7 +617,7 @@
""
],
"tail": [
"(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);"
"(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = \" + c; })(a,b,c);"
],
"solutions": [
"var a = 11;\nvar b = 9;\nvar c = 3;\n\na -= 6;\nb -= 15;\nc -= 1;\n\n"
@ -658,7 +658,7 @@
""
],
"tail": [
"(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);"
"(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = \" + c; })(a,b,c);"
],
"solutions": [
"var a = 5;\nvar b = 12;\nvar c = 4.6;\n\na *= 5;\nb *= 3;\nc *= 10;"
@ -2688,7 +2688,7 @@
"function myTest(val) {\n if(val < 5) {\n return \"Less than 5\"; \n } else if (val < 10) {\n return \"Less than 10\";\n } else {\n return \"Greater than or equal to 10\";\n }\n}"
],
"tests": [
"assert(myTest(4) === \"Less than 5\", 'message: <code>myTest(5)</code> should return \"Less than 5\"');",
"assert(myTest(4) === \"Less than 5\", 'message: <code>myTest(4)</code> should return \"Less than 5\"');",
"assert(myTest(6) === \"Less than 10\", 'message: <code>myTest(6)</code> should return \"Less than 10\"');",
"assert(myTest(11) === \"Greater than or equal to 10\", 'message: <code>myTest(11)</code> should return \"Greater than or equal to 10\"');"
],

View File

@ -502,7 +502,7 @@
"assert($(\"p\").length > 1, 'message: You need 2 <code>p</code> elements with Kitty Ipsum text.');",
"assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/<p/g).length, 'message: Make sure each of your <code>p</code> elements has a closing tag.');",
"assert.isTrue((/Purr\\s+jump\\s+eat/gi).test($(\"p\").text()), 'message: Your <code>p</code> element should contain the first few words of the provided additional <code>kitty ipsum text</code>.');",
"assert($(\"p:eq(0)\").css(\"font-size\") === \"16px\" && $(\"p:eq(1)\").css(\"font-size\") === \"16px\", 'message: Give elements with the <code>p</code> tag a <code>font-size</code> of <code>16px</code>.')"
"assert(Number.parseInt($(\"p:eq(0)\").css(\"font-size\"), 10) > 15 && Number.parseInt($(\"p:eq(1)\").css(\"font-size\"), 10) > 15, 'message: Give elements with the <code>p</code> tag a <code>font-size</code> of <code>16px</code>.')"
],
"type": "waypoint",
"challengeType": 0,
@ -1820,7 +1820,7 @@
"tests": [
"assert($(\"form\").children(\"button\").length > 0, 'message: Your form should have a button inside it.');",
"assert($(\"button\").attr(\"type\") === \"submit\", 'message: Your submit button should have the attribute <code>type</code> set to <code>submit</code>.');",
"assert($(\"button\").text().match(/submit/gi), 'message: Your submit button should have the text \"submit\".');",
"assert($(\"button\").text().match(/submit/gi), 'message: Your submit button should have the text \"Submit\".');",
"assert(code.match(/<\\/button>/g) && code.match(/<button/g) && code.match(/<\\/button>/g).length === code.match(/<button/g).length, 'message: Make sure your <code>button</code> element has a closing tag.');"
],
"type": "waypoint",

View File

@ -17,6 +17,8 @@ MongoClient.connect(secrets.db, function(err, database) {
if (err) {
throw err;
}
var firstTime = true;
var stream = database.collection('user')
.find({'completedChallenges': { $ne: null },
'isLocked': { $ne: true } },
@ -36,7 +38,12 @@ MongoClient.connect(secrets.db, function(err, database) {
});
});
if (dataOut.length) {
console.log(JSON.stringify(dataOut) + ',');
if (!firstTime) {
console.log(',' + JSON.stringify(dataOut));
} else {
firstTime = false;
console.log(JSON.stringify(dataOut));
}
}
}
}).on('end', function() {