add courseware controller and routes
This commit is contained in:
13
app.js
13
app.js
@ -32,6 +32,7 @@ var express = require('express'),
|
|||||||
userController = require('./controllers/user'),
|
userController = require('./controllers/user'),
|
||||||
contactController = require('./controllers/contact'),
|
contactController = require('./controllers/contact'),
|
||||||
bonfireController = require('./controllers/bonfire'),
|
bonfireController = require('./controllers/bonfire'),
|
||||||
|
coursewareController = require('./controllers/courseware'),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User model
|
* User model
|
||||||
@ -270,7 +271,6 @@ app.get('/account/api', userController.getAccountAngular);
|
|||||||
*/
|
*/
|
||||||
app.get('/playground', bonfireController.index);
|
app.get('/playground', bonfireController.index);
|
||||||
app.get('/bonfires', bonfireController.returnNextBonfire);
|
app.get('/bonfires', bonfireController.returnNextBonfire);
|
||||||
//app.get('/courseware', bonfireController.courseware);
|
|
||||||
app.get('/bonfire-json-generator', bonfireController.returnGenerator);
|
app.get('/bonfire-json-generator', bonfireController.returnGenerator);
|
||||||
app.post('/bonfire-json-generator', bonfireController.generateChallenge);
|
app.post('/bonfire-json-generator', bonfireController.generateChallenge);
|
||||||
app.get('/bonfire-challenge-generator', bonfireController.publicGenerator);
|
app.get('/bonfire-challenge-generator', bonfireController.publicGenerator);
|
||||||
@ -285,6 +285,17 @@ app.get('/bonfire', function(req, res) {
|
|||||||
|
|
||||||
app.post('/completed-bonfire/', bonfireController.completedBonfire);
|
app.post('/completed-bonfire/', bonfireController.completedBonfire);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Courseware related routes
|
||||||
|
*/
|
||||||
|
|
||||||
|
app.get('/coursewares', coursewareController.returnNextCourseware);
|
||||||
|
app.get(
|
||||||
|
'/coursewares/:coursewareName',
|
||||||
|
coursewareController.returnIndividualCourseware
|
||||||
|
);
|
||||||
|
app.post('/completed-courseware/', coursewareController.completedCourseware);
|
||||||
|
|
||||||
// Unique Check API route
|
// Unique Check API route
|
||||||
app.get('/api/checkUniqueUsername/:username', userController.checkUniqueUsername);
|
app.get('/api/checkUniqueUsername/:username', userController.checkUniqueUsername);
|
||||||
app.get('/api/checkExistingUsername/:username', userController.checkExistingUsername);
|
app.get('/api/checkExistingUsername/:username', userController.checkExistingUsername);
|
||||||
|
@ -36,13 +36,10 @@ exports.index = function(req, res) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.returnNextBonfire = function(req, res, next) {
|
exports.returnNextBonfire = function(req, res) {
|
||||||
if (!req.user) {
|
if (!req.user) {
|
||||||
return res.redirect('bonfires/meet-bonfire');
|
return res.redirect('bonfires/meet-bonfire');
|
||||||
}
|
}
|
||||||
var currentTime = parseInt(+new Date() / 1000);
|
|
||||||
if (currentTime - req.user.lastContentSync > 10) {
|
|
||||||
req.user.lastContentSync = currentTime;
|
|
||||||
var completed = req.user.completedBonfires.map(function (elem) {
|
var completed = req.user.completedBonfires.map(function (elem) {
|
||||||
return elem._id;
|
return elem._id;
|
||||||
});
|
});
|
||||||
@ -53,12 +50,9 @@ exports.returnNextBonfire = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
req.user.save();
|
req.user.save();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var uncompletedBonfires = req.user.uncompletedBonfires;
|
var uncompletedBonfires = req.user.uncompletedBonfires;
|
||||||
|
|
||||||
|
|
||||||
var displayedBonfires = Bonfire.find({'_id': uncompletedBonfires[0]});
|
var displayedBonfires = Bonfire.find({'_id': uncompletedBonfires[0]});
|
||||||
displayedBonfires.exec(function(err, bonfire) {
|
displayedBonfires.exec(function(err, bonfire) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1,180 +1,113 @@
|
|||||||
var _ = require('lodash'),
|
var _ = require('lodash'),
|
||||||
debug = require('debug')('freecc:cntr:bonfires'),
|
debug = require('debug')('freecc:cntr:courseware'),
|
||||||
Bonfire = require('./../models/Bonfire'),
|
Courseware = require('./../models/Courseware'),
|
||||||
User = require('./../models/User'),
|
User = require('./../models/User'),
|
||||||
resources = require('./resources');
|
resources = require('./resources');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bonfire controller
|
* Courseware controller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.bonfireNames = function(req, res) {
|
exports.coursewareNames = function(req, res) {
|
||||||
res.render('bonfires/showList', {
|
res.render('coursewares/showList', {
|
||||||
bonfireList: resources.allBonfireNames()
|
coursewareList: resources.allCoursewareNames()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.index = function(req, res) {
|
exports.returnNextCourseware = function(req, res) {
|
||||||
res.render('bonfire/show.jade', {
|
|
||||||
completedWith: null,
|
|
||||||
title: 'Bonfire Playground',
|
|
||||||
name: 'Bonfire Playground',
|
|
||||||
difficulty: 0,
|
|
||||||
brief: 'Feel free to play around!',
|
|
||||||
details: '',
|
|
||||||
tests: [],
|
|
||||||
challengeSeed: '',
|
|
||||||
challengeEntryPoint: '',
|
|
||||||
cc: req.user ? req.user.bonfiresHash : undefined,
|
|
||||||
points: req.user ? req.user.points : undefined,
|
|
||||||
verb: resources.randomVerb(),
|
|
||||||
phrase: resources.randomPhrase(),
|
|
||||||
compliments: resources.randomCompliment(),
|
|
||||||
bonfires: [],
|
|
||||||
bonfireHash: 'test'
|
|
||||||
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.returnNextBonfire = function(req, res, next) {
|
|
||||||
if (!req.user) {
|
if (!req.user) {
|
||||||
return res.redirect('bonfires/meet-bonfire');
|
return res.redirect('coursewares/intro');
|
||||||
}
|
}
|
||||||
var currentTime = parseInt(+new Date() / 1000);
|
var completed = req.user.completedCoursewares.map(function (elem) {
|
||||||
if (currentTime - req.user.lastContentSync > 10) {
|
|
||||||
req.user.lastContentSync = currentTime;
|
|
||||||
var completed = req.user.completedBonfires.map(function (elem) {
|
|
||||||
return elem._id;
|
return elem._id;
|
||||||
});
|
});
|
||||||
|
|
||||||
req.user.uncompletedBonfires = resources.allBonfireIds().filter(function (elem) {
|
req.user.uncompletedCoursewares = resources.allCoursewareIds().filter(function (elem) {
|
||||||
if (completed.indexOf(elem) === -1) {
|
if (completed.indexOf(elem) === -1) {
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
req.user.save();
|
req.user.save();
|
||||||
}
|
|
||||||
|
|
||||||
|
var uncompletedCoursewares = req.user.uncompletedCoursewares;
|
||||||
|
|
||||||
var uncompletedBonfires = req.user.uncompletedBonfires;
|
var displayedCoursewares = Courseware.find({'_id': uncompletedCoursewares[0]});
|
||||||
|
displayedCoursewares.exec(function(err, courseware) {
|
||||||
|
|
||||||
var displayedBonfires = Bonfire.find({'_id': uncompletedBonfires[0]});
|
|
||||||
displayedBonfires.exec(function(err, bonfire) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
next(err);
|
next(err);
|
||||||
}
|
}
|
||||||
bonfire = bonfire.pop();
|
courseware = courseware.pop();
|
||||||
nameString = bonfire.name.toLowerCase().replace(/\s/g, '-');
|
nameString = courseware.name.toLowerCase().replace(/\s/g, '-');
|
||||||
return res.redirect('/bonfires/' + nameString);
|
return res.redirect('/coursewares/' + nameString);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.returnIndividualBonfire = function(req, res, next) {
|
exports.returnIndividualCourseware = function(req, res, next) {
|
||||||
var dashedName = req.params.bonfireName;
|
var dashedName = req.params.coursewareName;
|
||||||
|
|
||||||
bonfireName = dashedName.replace(/\-/g, ' ');
|
coursewareName = dashedName.replace(/\-/g, ' ');
|
||||||
|
|
||||||
Bonfire.find({"name" : new RegExp(bonfireName, 'i')}, function(err, bonfire) {
|
Courseware.find({"name" : new RegExp(coursewareName, 'i')}, function(err, courseware) {
|
||||||
if (err) {
|
if (err) {
|
||||||
next(err);
|
next(err);
|
||||||
}
|
}
|
||||||
if (bonfire.length < 1) {
|
if (courseware.length < 1) {
|
||||||
req.flash('errors', {
|
req.flash('errors', {
|
||||||
msg: "404: We couldn't find a bonfire with that name. Please double check the name."
|
msg: "404: We couldn't find a challenge with that name. Please double check the name."
|
||||||
});
|
});
|
||||||
return res.redirect('/bonfires')
|
return res.redirect('/coursewares')
|
||||||
} else {
|
} else {
|
||||||
bonfire = bonfire.pop();
|
courseware = courseware.pop();
|
||||||
res.render('bonfire/show', {
|
res.render('coursewares/show', {
|
||||||
completedWith: null,
|
title: courseware.name,
|
||||||
title: bonfire.name,
|
|
||||||
dashedName: dashedName,
|
dashedName: dashedName,
|
||||||
name: bonfire.name,
|
name: courseware.name,
|
||||||
difficulty: Math.floor(+bonfire.difficulty),
|
brief: courseware.description[0],
|
||||||
brief: bonfire.description[0],
|
details: courseware.description.slice(1),
|
||||||
details: bonfire.description.slice(1),
|
tests: courseware.tests,
|
||||||
tests: bonfire.tests,
|
challengeSeed: courseware.challengeSeed,
|
||||||
challengeSeed: bonfire.challengeSeed,
|
challengeEntryPoint: courseware.challengeEntryPoint,
|
||||||
challengeEntryPoint: bonfire.challengeEntryPoint,
|
|
||||||
cc: !!req.user,
|
cc: !!req.user,
|
||||||
points: req.user ? req.user.points : undefined,
|
points: req.user ? req.user.points : undefined,
|
||||||
verb: resources.randomVerb(),
|
verb: resources.randomVerb(),
|
||||||
phrase: resources.randomPhrase(),
|
phrase: resources.randomPhrase(),
|
||||||
compliment: resources.randomCompliment(),
|
compliment: resources.randomCompliment(),
|
||||||
bonfires: bonfire,
|
coursewareHash: courseware._id
|
||||||
bonfireHash: bonfire._id
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
exports.testCourseware = function(req, res) {
|
||||||
* Bonfire generator
|
var coursewareName = req.body.name,
|
||||||
*/
|
coursewareTests = req.body.tests,
|
||||||
exports.returnGenerator = function(req, res) {
|
coursewareDifficulty = req.body.difficulty,
|
||||||
res.render('bonfire/generator', {
|
coursewareDescription = req.body.description,
|
||||||
title: null,
|
coursewareEntryPoint = req.body.challengeEntryPoint,
|
||||||
name: null,
|
coursewareChallengeSeed = req.body.challengeSeed;
|
||||||
difficulty: null,
|
coursewareTests = coursewareTests.split('\r\n');
|
||||||
brief: null,
|
coursewareDescription = coursewareDescription.split('\r\n');
|
||||||
details: null,
|
coursewareTests.filter(getRidOfEmpties);
|
||||||
tests: null,
|
coursewareDescription.filter(getRidOfEmpties);
|
||||||
challengeSeed: null,
|
coursewareChallengeSeed = coursewareChallengeSeed.replace('\r', '');
|
||||||
challengeEntryPoint: null,
|
res.render('courseware/show', {
|
||||||
bonfireHash: randomString()
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Post for bonfire generation
|
|
||||||
*/
|
|
||||||
|
|
||||||
function randomString() {
|
|
||||||
var chars = "0123456789abcdef";
|
|
||||||
var string_length = 23;
|
|
||||||
var randomstring = 'a';
|
|
||||||
for (var i=0; i<string_length; i++) {
|
|
||||||
var rnum = Math.floor(Math.random() * chars.length);
|
|
||||||
randomstring += chars.substring(rnum,rnum+1);
|
|
||||||
}
|
|
||||||
return randomstring;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
exports.testBonfire = function(req, res) {
|
|
||||||
var bonfireName = req.body.name,
|
|
||||||
bonfireTests = req.body.tests,
|
|
||||||
bonfireDifficulty = req.body.difficulty,
|
|
||||||
bonfireDescription = req.body.description,
|
|
||||||
bonfireEntryPoint = req.body.challengeEntryPoint,
|
|
||||||
bonfireChallengeSeed = req.body.challengeSeed;
|
|
||||||
bonfireTests = bonfireTests.split('\r\n');
|
|
||||||
bonfireDescription = bonfireDescription.split('\r\n');
|
|
||||||
bonfireTests.filter(getRidOfEmpties);
|
|
||||||
bonfireDescription.filter(getRidOfEmpties);
|
|
||||||
bonfireChallengeSeed = bonfireChallengeSeed.replace('\r', '');
|
|
||||||
res.render('bonfire/show', {
|
|
||||||
completedWith: null,
|
completedWith: null,
|
||||||
title: bonfireName,
|
title: coursewareName,
|
||||||
name: bonfireName,
|
name: coursewareName,
|
||||||
difficulty: +bonfireDifficulty,
|
difficulty: +coursewareDifficulty,
|
||||||
brief: bonfireDescription[0],
|
brief: coursewareDescription[0],
|
||||||
details: bonfireDescription.slice(1),
|
details: coursewareDescription.slice(1),
|
||||||
tests: bonfireTests,
|
tests: coursewareTests,
|
||||||
challengeSeed: bonfireChallengeSeed,
|
challengeSeed: coursewareChallengeSeed,
|
||||||
challengeEntryPoint: bonfireEntryPoint,
|
challengeEntryPoint: coursewareEntryPoint,
|
||||||
cc: req.user ? req.user.bonfiresHash : undefined,
|
cc: req.user ? req.user.coursewaresHash : undefined,
|
||||||
points: req.user ? req.user.points : undefined,
|
points: req.user ? req.user.points : undefined,
|
||||||
verb: resources.randomVerb(),
|
verb: resources.randomVerb(),
|
||||||
phrase: resources.randomPhrase(),
|
phrase: resources.randomPhrase(),
|
||||||
compliment: resources.randomCompliment(),
|
compliment: resources.randomCompliment(),
|
||||||
bonfires: [],
|
coursewares: [],
|
||||||
bonfireHash: "test"
|
coursewareHash: "test"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -185,97 +118,49 @@ function getRidOfEmpties(elem) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.publicGenerator = function(req, res) {
|
exports.publicGenerator = function(req, res) {
|
||||||
res.render('bonfire/public-generator');
|
res.render('courseware/public-generator');
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.generateChallenge = function(req, res) {
|
exports.generateChallenge = function(req, res) {
|
||||||
var bonfireName = req.body.name,
|
var coursewareName = req.body.name,
|
||||||
bonfireTests = req.body.tests,
|
coursewareTests = req.body.tests,
|
||||||
bonfireDifficulty = req.body.difficulty,
|
coursewareDifficulty = req.body.difficulty,
|
||||||
bonfireDescription = req.body.description,
|
coursewareDescription = req.body.description,
|
||||||
bonfireEntryPoint = req.body.challengeEntryPoint,
|
coursewareEntryPoint = req.body.challengeEntryPoint,
|
||||||
bonfireChallengeSeed = req.body.challengeSeed;
|
coursewareChallengeSeed = req.body.challengeSeed;
|
||||||
bonfireTests = bonfireTests.split('\r\n');
|
coursewareTests = coursewareTests.split('\r\n');
|
||||||
bonfireDescription = bonfireDescription.split('\r\n');
|
coursewareDescription = coursewareDescription.split('\r\n');
|
||||||
bonfireTests.filter(getRidOfEmpties);
|
coursewareTests.filter(getRidOfEmpties);
|
||||||
bonfireDescription.filter(getRidOfEmpties);
|
coursewareDescription.filter(getRidOfEmpties);
|
||||||
bonfireChallengeSeed = bonfireChallengeSeed.replace('\r', '');
|
coursewareChallengeSeed = coursewareChallengeSeed.replace('\r', '');
|
||||||
|
|
||||||
|
|
||||||
var response = {
|
var response = {
|
||||||
_id: randomString(),
|
_id: randomString(),
|
||||||
name: bonfireName,
|
name: coursewareName,
|
||||||
difficulty: bonfireDifficulty,
|
difficulty: coursewareDifficulty,
|
||||||
description: bonfireDescription,
|
description: coursewareDescription,
|
||||||
challengeEntryPoint: bonfireEntryPoint,
|
challengeEntryPoint: coursewareEntryPoint,
|
||||||
challengeSeed: bonfireChallengeSeed,
|
challengeSeed: coursewareChallengeSeed,
|
||||||
tests: bonfireTests
|
tests: coursewareTests
|
||||||
};
|
};
|
||||||
res.send(response);
|
res.send(response);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.completedBonfire = function (req, res) {
|
exports.completedCourseware = function (req, res) {
|
||||||
var isCompletedWith = req.body.bonfireInfo.completedWith || undefined;
|
|
||||||
var isCompletedDate = Math.round(+new Date() / 1000);
|
var isCompletedDate = Math.round(+new Date() / 1000);
|
||||||
var bonfireHash = req.body.bonfireInfo.bonfireHash;
|
var coursewareHash = req.body.coursewareInfo.coursewareHash;
|
||||||
var isSolution = req.body.bonfireInfo.solution;
|
|
||||||
|
|
||||||
if (isCompletedWith) {
|
req.user.completedCoursewares.push({
|
||||||
var paired = User.find({"profile.username": isCompletedWith}).limit(1);
|
_id: coursewareHash,
|
||||||
paired.exec(function (err, pairedWith) {
|
|
||||||
if (err) {
|
|
||||||
return err;
|
|
||||||
} else {
|
|
||||||
var index = req.user.uncompletedBonfires.indexOf(bonfireHash);
|
|
||||||
|
|
||||||
if (index > -1) {
|
|
||||||
req.user.uncompletedBonfires.splice(index, 1)
|
|
||||||
}
|
|
||||||
pairedWith = pairedWith.pop();
|
|
||||||
|
|
||||||
index = pairedWith.uncompletedBonfires.indexOf(bonfireHash);
|
|
||||||
if (index > -1) {
|
|
||||||
pairedWith.uncompletedBonfires.splice(index, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
pairedWith.completedBonfires.push({
|
|
||||||
_id: bonfireHash,
|
|
||||||
completedWith: req.user._id,
|
|
||||||
completedDate: isCompletedDate,
|
|
||||||
solution: isSolution
|
|
||||||
})
|
|
||||||
|
|
||||||
req.user.completedBonfires.push({
|
|
||||||
_id: bonfireHash,
|
|
||||||
completedWith: pairedWith._id,
|
|
||||||
completedDate: isCompletedDate,
|
|
||||||
solution: isSolution
|
|
||||||
})
|
|
||||||
|
|
||||||
req.user.save(function (err, user) {
|
|
||||||
pairedWith.save(function (err, paired) {
|
|
||||||
if (err) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
if (user && paired) {
|
|
||||||
res.send(true);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
|
|
||||||
req.user.completedBonfires.push({
|
|
||||||
_id: bonfireHash,
|
|
||||||
completedWith: null,
|
completedWith: null,
|
||||||
completedDate: isCompletedDate,
|
completedDate: isCompletedDate,
|
||||||
solution: isSolution
|
solution: isSolution
|
||||||
});
|
});
|
||||||
|
|
||||||
var index = req.user.uncompletedBonfires.indexOf(bonfireHash);
|
var index = req.user.uncompletedCoursewares.indexOf(coursewareHash);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
req.user.uncompletedBonfires.splice(index, 1)
|
req.user.uncompletedCoursewares.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
req.user.save(function (err, user) {
|
req.user.save(function (err, user) {
|
||||||
@ -287,5 +172,4 @@ exports.completedBonfire = function (req, res) {
|
|||||||
res.send(true)
|
res.send(true)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
};
|
};
|
@ -5,6 +5,7 @@ var User = require('../models/User'),
|
|||||||
secrets = require('./../config/secrets'),
|
secrets = require('./../config/secrets'),
|
||||||
Challenge = require('./../models/Challenge'),
|
Challenge = require('./../models/Challenge'),
|
||||||
bonfires = require('../seed_data/bonfires.json');
|
bonfires = require('../seed_data/bonfires.json');
|
||||||
|
coursewares = require('../seed_data/coursewares.json');
|
||||||
Client = require('node-rest-client').Client,
|
Client = require('node-rest-client').Client,
|
||||||
client = new Client(),
|
client = new Client(),
|
||||||
debug = require('debug')('freecc:cntr:bonfires');
|
debug = require('debug')('freecc:cntr:bonfires');
|
||||||
@ -217,7 +218,37 @@ module.exports = {
|
|||||||
.map(function(elem) {
|
.map(function(elem) {
|
||||||
return elem.name;
|
return elem.name;
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
allCoursewareIds: function() {
|
||||||
|
return coursewares.map(function(elem) {
|
||||||
|
return {
|
||||||
|
_id: elem._id,
|
||||||
|
difficulty: elem.difficulty
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.sort(function(a, b) {
|
||||||
|
return a.difficulty - b.difficulty;
|
||||||
|
})
|
||||||
|
.map(function(elem) {
|
||||||
|
return elem._id;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
allCoursewareNames: function() {
|
||||||
|
return coursewares.map(function(elem) {
|
||||||
|
return {
|
||||||
|
name: elem.name,
|
||||||
|
difficulty: elem.difficulty
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.sort(function(a, b) {
|
||||||
|
return a.difficulty - b.difficulty;
|
||||||
|
})
|
||||||
|
.map(function(elem) {
|
||||||
|
return elem.name;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@ var coursewareSchema = new mongoose.Schema({
|
|||||||
difficulty: String,
|
difficulty: String,
|
||||||
description: Array,
|
description: Array,
|
||||||
tests: Array,
|
tests: Array,
|
||||||
challengeSeed: String,
|
challengeSeed: String
|
||||||
challengeEntryPoint: String
|
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = mongoose.model('Courseware', coursewareSchema);
|
module.exports = mongoose.model('Courseware', coursewareSchema);
|
@ -355,10 +355,8 @@ var userSchema = new mongoose.Schema({
|
|||||||
resetPasswordExpires: Date,
|
resetPasswordExpires: Date,
|
||||||
uncompletedBonfires: Array,
|
uncompletedBonfires: Array,
|
||||||
completedBonfires: Array,
|
completedBonfires: Array,
|
||||||
lastContentSync: {
|
uncompletedCoursewares: Array,
|
||||||
type: Number,
|
completedCoursewares: Array
|
||||||
default: 0
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,11 +18,11 @@ block content
|
|||||||
script(src='/js/lib/codemirror/mode/css/css.js')
|
script(src='/js/lib/codemirror/mode/css/css.js')
|
||||||
script(src='/js/lib/codemirror/mode/htmlmixed/htmlmixed.js')
|
script(src='/js/lib/codemirror/mode/htmlmixed/htmlmixed.js')
|
||||||
.row
|
.row
|
||||||
.col-xs-12.col-sm-12.col-md-3.bonfire-top
|
.col-xs-12.col-sm-12.col-md-3
|
||||||
h2.text-center= name
|
|
||||||
.well
|
.well
|
||||||
.row
|
.row
|
||||||
.col-xs-12
|
.col-xs-12
|
||||||
|
h2.text-center= name
|
||||||
.bonfire-instructions
|
.bonfire-instructions
|
||||||
p= brief
|
p= brief
|
||||||
#brief-instructions
|
#brief-instructions
|
||||||
@ -38,9 +38,9 @@ block content
|
|||||||
button#less-info.btn.btn-info
|
button#less-info.btn.btn-info
|
||||||
span.ion-help-circled
|
span.ion-help-circled
|
||||||
| Less information
|
| Less information
|
||||||
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
//#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
||||||
br
|
//br
|
||||||
form.code
|
//form.code
|
||||||
.form-group.codeMirrorView
|
.form-group.codeMirrorView
|
||||||
textarea#codeOutput
|
textarea#codeOutput
|
||||||
br
|
br
|
||||||
@ -49,8 +49,7 @@ block content
|
|||||||
script(type="text/javascript").
|
script(type="text/javascript").
|
||||||
var tests = !{JSON.stringify(tests)};
|
var tests = !{JSON.stringify(tests)};
|
||||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||||
var challengeEntryPoint = !{JSON.stringify(challengeEntryPoint)};
|
var passedCoursewareHash = !{JSON.stringify(coursewareHash)};
|
||||||
var passedBonfireHash = !{JSON.stringify(bonfireHash)};
|
|
||||||
.col-xs-12.col-sm-12.col-md-5
|
.col-xs-12.col-sm-12.col-md-5
|
||||||
#mainEditorPanel
|
#mainEditorPanel
|
||||||
form.code
|
form.code
|
||||||
|
Reference in New Issue
Block a user