set last completed block in map view
This commit is contained in:
@ -471,6 +471,7 @@ module.exports = function(app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function challengeMap({ user = {} }, res, next) {
|
function challengeMap({ user = {} }, res, next) {
|
||||||
|
let lastCompleted;
|
||||||
const daysRunning = moment().diff(new Date('10/15/2014'), 'days');
|
const daysRunning = moment().diff(new Date('10/15/2014'), 'days');
|
||||||
|
|
||||||
// if user
|
// if user
|
||||||
@ -513,7 +514,13 @@ module.exports = function(app) {
|
|||||||
})
|
})
|
||||||
.filter(({ name }) => name !== 'Hikes')
|
.filter(({ name }) => name !== 'Hikes')
|
||||||
// turn stream of blocks into a stream of an array
|
// 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(
|
Observable.combineLatest(
|
||||||
camperCount$,
|
camperCount$,
|
||||||
@ -526,6 +533,7 @@ module.exports = function(app) {
|
|||||||
blocks,
|
blocks,
|
||||||
daysRunning,
|
daysRunning,
|
||||||
camperCount,
|
camperCount,
|
||||||
|
lastCompleted,
|
||||||
title: "A map of all Free Code Camp's Challenges"
|
title: "A map of all Free Code Camp's Challenges"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -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.
|
a.btn.btn-lg.btn-block.signup-btn.map-challenge-block-share Section complete. Share your Portfolio with your friends.
|
||||||
.hidden(id="#{challengeBlock.name}")
|
.hidden(id="#{challengeBlock.name}")
|
||||||
script.
|
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')
|
// #announcementModal.modal(tabindex='-1')
|
||||||
// .modal-dialog.animated.fadeInUp.fast-animation
|
// .modal-dialog.animated.fadeInUp.fast-animation
|
||||||
// .modal-content
|
// .modal-content
|
||||||
|
Reference in New Issue
Block a user