Use regex to hide hikes

Capitalize super block
This commit is contained in:
Berkeley Martinez 2015-12-04 22:37:15 -08:00
parent 8175fbb297
commit c736a5c00f
2 changed files with 13 additions and 5 deletions

View File

@ -44,9 +44,14 @@ destroy()
challenge.order = order;
challenge.suborder = index + 1;
challenge.block = block;
challenge.superBlock = superBlock;
challenge.isBeta = challenge.isBeta || isBeta;
challenge.time = challengeSpec.time;
challenge.superBlock = superBlock
.split('-')
.map(function(word) {
return _.capitalize(word);
})
.join(' ');
return challenge;
});

View File

@ -146,8 +146,9 @@ module.exports = function(app) {
challenges: blockArray,
superBlock: blockArray[0].superBlock
}))
.filter(({ name })=> {
return name !== 'Hikes';
.filter(({ superBlock }) => {
console.log('sup', superBlock);
return challengesRegex.test(superBlock);
})
.groupBy(block => block.superBlock)
.flatMap(superBlocks$ => superBlocks$.toArray())
@ -191,7 +192,7 @@ module.exports = function(app) {
// find challenge
return challenge$
.map(challenge => challenge.toJSON())
.filter(({ superBlock }) => superBlock !== 'hikes')
.filter(({ superBlock }) => challengesRegex.test(superBlock))
.filter(({ id }) => id === challengeId)
// now lets find the block it belongs to
.flatMap(challenge => {
@ -529,7 +530,9 @@ module.exports = function(app) {
time: blockArray[0] && blockArray[0].time || '???'
};
})
.filter(({ superBlock }) => superBlock !== 'hikes')
.filter(({ superBlock }) => {
return !(/hikes/i).test(superBlock);
})
// turn stream of blocks into a stream of an array
.toArray()
.doOnNext(blocks => {