fix completedWith.toLowerCase bug

This commit is contained in:
Berkeley Martinez
2015-08-03 16:35:22 -07:00
parent 4c94bf7fcd
commit a920e16cb9

View File

@ -372,7 +372,7 @@ module.exports = function(app) {
function completedZiplineOrBasejump(req, res, next) { function completedZiplineOrBasejump(req, res, next) {
var completedWith = req.body.challengeInfo.completedWith || false; var completedWith = req.body.challengeInfo.completedWith || '';
var completedDate = Math.round(+new Date()); var completedDate = Math.round(+new Date());
var challengeId = req.body.challengeInfo.challengeId; var challengeId = req.body.challengeInfo.challengeId;
var solutionLink = req.body.challengeInfo.publicURL; var solutionLink = req.body.challengeInfo.publicURL;
@ -423,17 +423,17 @@ module.exports = function(app) {
pairedWith: pairedWith pairedWith: pairedWith
}; };
}) })
.doOnNext(function(dats) { .doOnNext(function({ user, pairedWith }) {
updateUserProgress( updateUserProgress(
dats.user, user,
challengeId, challengeId,
dats.pairedWith ? pairedWith ?
assign({ completedWith: dats.pairedWith.id }, challengeData) : assign({ completedWith: pairedWith.id }, challengeData) :
challengeData challengeData
); );
}) })
.flatMap(function(dats) { .flatMap(function({ user, pairedWith }) {
return Rx.Observable.from([dats.user, dats.pairedWith]); return Rx.Observable.from([user, pairedWith]);
}) })
// save users // save users
.flatMap(function(user) { .flatMap(function(user) {