Merge branch 'master' into courseware
This commit is contained in:
@ -38,7 +38,7 @@ exports.index = function(req, res) {
|
|||||||
|
|
||||||
exports.returnNextBonfire = function(req, res) {
|
exports.returnNextBonfire = function(req, res) {
|
||||||
if (!req.user) {
|
if (!req.user) {
|
||||||
return res.redirect('bonfires/meet-bonfire');
|
return res.redirect('../bonfires/meet-bonfire');
|
||||||
}
|
}
|
||||||
var completed = req.user.completedBonfires.map(function (elem) {
|
var completed = req.user.completedBonfires.map(function (elem) {
|
||||||
return elem._id;
|
return elem._id;
|
||||||
@ -76,7 +76,7 @@ exports.returnIndividualBonfire = function(req, res, next) {
|
|||||||
bonfire = bonfire.pop()
|
bonfire = bonfire.pop()
|
||||||
var dashedNameFull = bonfire.name.toLowerCase().replace(/\s/g, '-');
|
var dashedNameFull = bonfire.name.toLowerCase().replace(/\s/g, '-');
|
||||||
if (dashedNameFull != dashedName) {
|
if (dashedNameFull != dashedName) {
|
||||||
return res.redirect('/bonfires/' + dashedNameFull);
|
return res.redirect('../bonfires/' + dashedNameFull);
|
||||||
}
|
}
|
||||||
if (bonfire.length < 1) {
|
if (bonfire.length < 1) {
|
||||||
req.flash('errors', {
|
req.flash('errors', {
|
||||||
|
BIN
public/fonts/glyphicons-halflings-regular.eot
Normal file
BIN
public/fonts/glyphicons-halflings-regular.eot
Normal file
Binary file not shown.
@ -116,7 +116,6 @@ function bonfireExecute() {
|
|||||||
if (challengeEntryPoint && challengeSeed) {
|
if (challengeEntryPoint && challengeSeed) {
|
||||||
userJavaScript = challengeEntryPoint + ' ' + userJavaScript;
|
userJavaScript = challengeEntryPoint + ' ' + userJavaScript;
|
||||||
}
|
}
|
||||||
console.log(userJavaScript);
|
|
||||||
submit(userJavaScript, function(cls, message) {
|
submit(userJavaScript, function(cls, message) {
|
||||||
if (cls) {
|
if (cls) {
|
||||||
codeOutput.setValue(message.error);
|
codeOutput.setValue(message.error);
|
||||||
@ -210,7 +209,6 @@ var runTests = function(err, data) {
|
|||||||
userTests.forEach(function(test, ix, arr){
|
userTests.forEach(function(test, ix, arr){
|
||||||
try {
|
try {
|
||||||
if (test) {
|
if (test) {
|
||||||
console.log();
|
|
||||||
var output = eval(reassembleTest(test, data));
|
var output = eval(reassembleTest(test, data));
|
||||||
}
|
}
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
@ -232,7 +230,8 @@ var runTests = function(err, data) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function showCompletion() {
|
function showCompletion() {
|
||||||
|
var time = Math.floor(Date.now() / 1000) - started;
|
||||||
ga('send', 'event', 'Bonfire', 'solved', bonfireName + ', Time: ' + (Math.floor(Date.now() / 1000) - started) +', Attempts: ' + attempts);
|
console.log(time);
|
||||||
|
ga('send', 'event', 'Bonfire', 'solved', bonfireName + ', Time: ' + time +', Attempts: ' + attempts);
|
||||||
$('#complete-bonfire-dialog').modal('show');
|
$('#complete-bonfire-dialog').modal('show');
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if (bonfireName !== undefined) {
|
if (bonfireName) {
|
||||||
ga('send', 'event', 'Bonfire', 'load', bonfireName + ':' + Math.floor(Date.now() / 1000));
|
ga('send', 'event', 'Bonfire', 'load', bonfireName + ':' + Math.floor(Date.now() / 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,22 +149,23 @@
|
|||||||
"expect(sumAll([10, 5])).to.equal(45);"
|
"expect(sumAll([10, 5])).to.equal(45);"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"_id": "a5229172f011153519423690",
|
"_id": "a5229172f011153519423690",
|
||||||
"name": "Sum All Odd Fibonacci Numbers",
|
"name": "Sum All Odd Fibonacci Numbers",
|
||||||
"difficulty": "2.01",
|
|
||||||
"description": [
|
"description": [
|
||||||
"Return the sum of all odd fibonacci numbers up to and including the passed number.",
|
"Return the sum of all odd fibonacci numbers up to and including the passed number if it is a fibonacci number.",
|
||||||
"Starting from 1, the first few numbers of a Fibonacci sequence are 1, 2, 3, 5 and 8, and each subsequent number is the sum of the previous two numbers."
|
"The first few numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8, and each subsequent number is the sum of the previous two numbers.",
|
||||||
|
"As an example, passing 4 to the function should return 5 because all the odd fibonacci numbers under 4 are 1, 1, and 3."
|
||||||
],
|
],
|
||||||
"challengeEntryPoint": "sumFibs(1000);",
|
"challengeEntryPoint": "sumFibs(4);",
|
||||||
"challengeSeed": "function sumFibs(num) {\n return num;\r\n}",
|
"challengeSeed": "function sumFibs(num) {\n return num;\r\n}",
|
||||||
"tests": [
|
"tests": [
|
||||||
"expect(sumFibs(1)).to.be.a('number');",
|
"expect(sumFibs(1)).to.be.a('number');",
|
||||||
"expect(sumFibs(1000)).to.equal(3382);",
|
"expect(sumFibs(1000)).to.equal(1785);",
|
||||||
"expect(sumFibs(4000000)).to.equal(10316619);",
|
"expect(sumFibs(4000000)).to.equal(4613732);",
|
||||||
"expect(sumFibs(4)).to.equal(10);"
|
"expect(sumFibs(4)).to.equal(5);",
|
||||||
|
"expect(sumFibs(75024)).to.equal(60696);",
|
||||||
|
"expect(sumFibs(75025)).to.equal(135721);"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,8 @@ block content
|
|||||||
.col-sm-12.col-md-12.col-xs-12
|
.col-sm-12.col-md-12.col-xs-12
|
||||||
.panel.panel-primary
|
.panel.panel-primary
|
||||||
.panel-heading.text-center #{name} (takes #{time} minutes)
|
.panel-heading.text-center #{name} (takes #{time} minutes)
|
||||||
|
script.
|
||||||
|
var bonfireName = null;
|
||||||
.panel.panel-body
|
.panel.panel-body
|
||||||
.embed-responsive.embed-responsive-16by9
|
.embed-responsive.embed-responsive-16by9
|
||||||
iframe.embed-responsive-item(src='//player.vimeo.com/video/#{video}')
|
iframe.embed-responsive-item(src='//player.vimeo.com/video/#{video}')
|
||||||
|
Reference in New Issue
Block a user