diff --git a/server/boot/challenge.js b/server/boot/challenge.js index 15736e3a51..239d21d4d0 100644 --- a/server/boot/challenge.js +++ b/server/boot/challenge.js @@ -471,6 +471,7 @@ module.exports = function(app) { } function challengeMap({ user = {} }, res, next) { + let lastCompleted; const daysRunning = moment().diff(new Date('10/15/2014'), 'days'); // if user @@ -513,7 +514,13 @@ module.exports = function(app) { }) .filter(({ name }) => name !== 'Hikes') // turn stream of blocks into a stream of an array - .toArray(); + .toArray() + .doOnNext((blocks) => { + const lastCompletedBlock = _.findLast(blocks, (block) => { + return block.completed === 100; + }); + lastCompleted = lastCompletedBlock.name; + }); Observable.combineLatest( camperCount$, @@ -526,6 +533,7 @@ module.exports = function(app) { blocks, daysRunning, camperCount, + lastCompleted, title: "A map of all Free Code Camp's Challenges" }); }, diff --git a/server/views/challengeMap/show.jade b/server/views/challengeMap/show.jade index 4ac3064426..21515a3613 100644 --- a/server/views/challengeMap/show.jade +++ b/server/views/challengeMap/show.jade @@ -138,7 +138,8 @@ block content a.btn.btn-lg.btn-block.signup-btn.map-challenge-block-share Section complete. Share your Portfolio with your friends. .hidden(id="#{challengeBlock.name}") script. - var username = !{JSON.stringify(user && user.username || "")}; + var username = !{JSON.stringify(user && user.username || '')}; + var lastCompleted = !{JSON.stringify(lastCompleted || false)} // #announcementModal.modal(tabindex='-1') // .modal-dialog.animated.fadeInUp.fast-animation // .modal-content