Fix for old challenge names in account view so linking still works.

This commit is contained in:
terakilobyte
2015-05-26 08:32:17 -04:00
parent 4e4031c5d4
commit f15d7daa2e

View File

@@ -147,10 +147,12 @@ exports.returnCurrentChallenge = function(req, res, next) {
exports.returnIndividualChallenge = function(req, res, next) {
var dashedName = req.params.challengeName;
var challengeName = dashedName.replace(/\-/g, ' ')
.split(' ')
.slice(1)
.join(' ');
var challengeName = /^(bonfire|waypoint)/.test(dashedName) ? dashedName
.replace(/\-/g, ' ')
.split(' ')
.slice(1)
.join(' ')
: dashedName;
Challenge.find({'name': new RegExp(challengeName, 'i')},
function(err, challengeFromMongo) {