diff --git a/README.md b/README.md
index e265bcf181..0307641300 100644
--- a/README.md
+++ b/README.md
@@ -110,7 +110,7 @@ Project Structure
| **models**/Challenge.js | Mongoose schema and model for Challenge. |
| **public**/ | Static assets (fonts, css, js, img). |
| **public**/**js**/application.js | Specify client-side JavaScript dependencies. |
-| **public**/**js**/main.js | Place your client-side JavaScript here. |
+| **public**/**js**/main_0.0.2.js | Place your client-side JavaScript here. |
| **public**/**css**/main.less | Main stylesheet for the app. |
| **views/account**/ | Templates for *login, password reset, signup, profile*. |
| **views/partials**/flash.jade | Error, info and success flash notifications. |
diff --git a/controllers/challenge.js b/controllers/challenge.js
index 38d05e6bf6..12a3c3655e 100644
--- a/controllers/challenge.js
+++ b/controllers/challenge.js
@@ -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|zipline|basejump)/i.test(dashedName) ? dashedName
+ .replace(/\-/g, ' ')
+ .split(' ')
+ .slice(1)
+ .join(' ')
+ : dashedName.replace(/\-/g, ' ');
Challenge.find({'name': new RegExp(challengeName, 'i')},
function(err, challengeFromMongo) {
@@ -455,6 +457,8 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
var solutionLink = req.body.challengeInfo.publicURL;
var githubLink = req.body.challengeInfo.challengeType === '4'
? req.body.challengeInfo.githubURL : true;
+ var challengeType = req.body.challengeInfo.challengeType === '4' ?
+ 4 : 3;
if (!solutionLink || !githubLink) {
req.flash('errors', {
msg: 'You haven\'t supplied the necessary URLs for us to inspect ' +
@@ -485,6 +489,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
completedDate: isCompletedDate,
solution: solutionLink,
githubLink: githubLink,
+ challengeType: challengeType,
verified: false
});
@@ -510,6 +515,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
completedDate: isCompletedDate,
solution: solutionLink,
githubLink: githubLink,
+ challengeType: challengeType,
verified: false
});
pairedWith.save(function (err, paired) {
@@ -532,6 +538,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) {
completedDate: isCompletedDate,
solution: solutionLink,
githubLink: githubLink,
+ challengeType: challengeType,
verified: false
});
diff --git a/controllers/user.js b/controllers/user.js
index ab000593ce..f83ac9e0be 100644
--- a/controllers/user.js
+++ b/controllers/user.js
@@ -398,8 +398,8 @@ exports.returnUser = function(req, res, next) {
user.currentStreak = user.currentStreak || 1;
user.longestStreak = user.longestStreak || 1;
- var challenges = user.completedCoursewares.filter(function ( obj ) {
- return !!obj.solution;
+ var challenges = user.completedChallenges.filter(function ( obj ) {
+ return obj.challengeType === 3 || obj.challengeType === 4;
});
res.render('account/show', {
diff --git a/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.2.js b/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js
similarity index 99%
rename from public/js/lib/coursewares/coursewaresHCJQFramework_0.1.2.js
rename to public/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js
index d3443ac6be..09248f6c38 100644
--- a/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.2.js
+++ b/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js
@@ -56,7 +56,7 @@ var allTests = '';
});
})();
-var otherTestsForNow = "";
+var otherTestsForNow = "";
var delay;
// Initialize CodeMirror editor with a nice html5 canvas demo.
diff --git a/public/js/lib/coursewares/coursewaresJSFramework_0.0.2.js b/public/js/lib/coursewares/coursewaresJSFramework_0.0.4.js
similarity index 99%
rename from public/js/lib/coursewares/coursewaresJSFramework_0.0.2.js
rename to public/js/lib/coursewares/coursewaresJSFramework_0.0.4.js
index 3abe01c1dc..9601fbe94d 100644
--- a/public/js/lib/coursewares/coursewaresJSFramework_0.0.2.js
+++ b/public/js/lib/coursewares/coursewaresJSFramework_0.0.4.js
@@ -194,7 +194,7 @@ var createTestDisplay = function() {
var expect = chai.expect;
var assert = chai.assert;
-var should = chai.should;
+var should = chai.should();
var reassembleTest = function(test, data) {
diff --git a/public/js/lib/coursewares/iFrameScripts_0.0.1.js b/public/js/lib/coursewares/iFrameScripts_0.0.2.js
similarity index 100%
rename from public/js/lib/coursewares/iFrameScripts_0.0.1.js
rename to public/js/lib/coursewares/iFrameScripts_0.0.2.js
diff --git a/public/js/main.js b/public/js/main_0.0.2.js
similarity index 99%
rename from public/js/main.js
rename to public/js/main_0.0.2.js
index ed6c881f99..b0c33c9293 100644
--- a/public/js/main.js
+++ b/public/js/main_0.0.2.js
@@ -17,6 +17,7 @@ $(document).ready(function() {
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
$('#i-want-help').on('click', function() {
+ /*
var editorValue = editor.getValue();
var currentLocation = window.location.href;
$.post(
@@ -33,9 +34,11 @@ $(document).ready(function() {
}
}
);
+ */
});
$('#i-want-help-editorless').on('click', function() {
+ /*
var currentLocation = window.location.href;
$.post(
'/get-help',
@@ -50,6 +53,7 @@ $(document).ready(function() {
}
}
);
+ */
});
$('#report-issue').on('click', function() {
diff --git a/seed_data/challenges/basic-bonfires.json b/seed_data/challenges/basic-bonfires.json
index 907fc7af9b..b35ce5c45b 100644
--- a/seed_data/challenges/basic-bonfires.json
+++ b/seed_data/challenges/basic-bonfires.json
@@ -836,7 +836,7 @@
"expect(smallestCommons([1,5])).to.be.a('number');",
"expect(smallestCommons([1,5])).to.equal(60);",
"expect(smallestCommons([5,1])).to.equal(60);",
- "(smallestCommons([1,13])).should.equal(360360);"
+ "expect(smallestCommons([1,13])).to.equal(360360);"
],
"MDNlinks" : ["Smallest Common Multiple"],
"challengeType": 5
@@ -866,7 +866,7 @@
},
{
"_id": "a5deed1811a43193f9f1c841",
- "name": "Bonfire: Drop it like it's hot",
+ "name": "Bonfire: Drop it",
"difficulty": "2.13",
"description": [
"Drop the elements of an array (first argument), starting from the front, until the predicate (second argument) returns true.",
diff --git a/seed_data/userMigration.js b/seed_data/userMigration.js
index 9b27cb3cd9..c1b44d81fa 100644
--- a/seed_data/userMigration.js
+++ b/seed_data/userMigration.js
@@ -3,10 +3,20 @@ require('dotenv').load();
var User = require('../models/User.js'),
secrets = require('../config/secrets'),
mongoose = require('mongoose'),
- R = require('ramda');
+ R = require('ramda'),
+ ziplines = require('./challenges/ziplines.json'),
+ basejumps = require('./challenges/basejumps.json');
mongoose.connect(secrets.db);
+var ziplineIds = ziplines.challenges.map(function(elem) {
+ return elem._id;
+});
+var basejumpIds = basejumps.challenges.map(function(elem) {
+ return elem._id;
+});
+var ziplineAndBaseJumpIds = R.concat(ziplineIds, basejumpIds);
+
function userModelAssurity(cb) {
console.log('userModelAssurity');
var i = 1;
@@ -91,23 +101,22 @@ function userModelMigration(cb) {
}
*/
user.needsMigration = false;
- user.completedChallenges = R.filter(function(elem) {
- return elem; // getting rid of undefined
- }, R.concat(
- user.completedCoursewares,
- user.completedBonfires.map(function(bonfire) {
+ user.completedChallenges = user.completedChallenges.map(function(elem) {
+ if (ziplineAndBaseJumpIds.indexOf(elem._id) > 0) {
return ({
- completedDate: bonfire.completedDate,
- _id: bonfire._id,
- name: bonfire.name,
- completedWith: bonfire.completedWith,
- solution: bonfire.solution,
- githubLink: '',
- verified: false,
- challengeType: 5
+ _id: elem._id,
+ name: elem.name,
+ completedWith: elem.completedWith,
+ completedDate: elem.completedDate,
+ solution: elem.solution,
+ githubLink: elem.githubLink,
+ verified: elem.verified,
+ challengeType: typeof elem.githubLink === 'boolean' ? 4 : 3
});
- })
- ));
+ } else {
+ return elem;
+ }
+ });
var self = this;
user.save(function (err) {
diff --git a/views/account/show.jade b/views/account/show.jade
index c3255edd26..b4887d84d4 100644
--- a/views/account/show.jade
+++ b/views/account/show.jade
@@ -150,7 +150,7 @@ block content
td.col-xs-4= challenge.name
td.col-xs-2= moment(challenge.completedDate, 'x').format("MMM DD, YYYY")
td.col-xs-6
- a(href=challenge.solution, target='_blank') View my solution
+ a(href="http://" + challenge.solution, target='_blank') View my solution
br
- if (bonfires.length > 0)
diff --git a/views/challengeMap/show.jade b/views/challengeMap/show.jade
index dbf757cb22..990ea9ebba 100644
--- a/views/challengeMap/show.jade
+++ b/views/challengeMap/show.jade
@@ -1,9 +1,6 @@
extends ../layout
block content
script.
- var waypointList = !{JSON.stringify(waypoints)};
- var ziplineList = !{JSON.stringify(ziplines)};
- var basejumpList = !{JSON.stringify(basejumps)};
var completedChallenges = !{JSON.stringify(completedChallengeList)};
.panel.panel-info
.panel-heading.text-center
diff --git a/views/coursewares/showBonfire.jade b/views/coursewares/showBonfire.jade
index 7e9e63e683..fae2aca563 100644
--- a/views/coursewares/showBonfire.jade
+++ b/views/coursewares/showBonfire.jade
@@ -94,9 +94,9 @@ block content
if (user && user.sentSlackInvite)
.button-spacer
.btn-group.input-group.btn-group-justified
- label.btn.btn-success#i-want-help
+ label.btn.btn-success#i-want-help(disabled)
i.fa.fa-medkit
- | Help
+ | Help(disabled)
label.btn.btn-success#i-want-to-pair
i.fa.fa-user-plus
| Pair
@@ -125,7 +125,7 @@ block content
form.code
.form-group.codeMirrorView
textarea#codeEditor(autofocus=true, style='display: none;')
- script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.2.js')
+ script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.4.js')
#complete-courseware-dialog.modal(tabindex='-1')
.modal-dialog.animated.zoomIn.fast-animation
diff --git a/views/coursewares/showHTML.jade b/views/coursewares/showHTML.jade
index 4a8f42fad6..681f48b14e 100644
--- a/views/coursewares/showHTML.jade
+++ b/views/coursewares/showHTML.jade
@@ -46,9 +46,9 @@ block content
if (user.sentSlackInvite)
.button-spacer
.btn-group.input-group.btn-group-justified
- label.btn.btn-success#i-want-help
+ label.btn.btn-success#i-want-help(disabled)
i.fa.fa-medkit
- | Help
+ | Help(disabled)
label.btn.btn-success#report-issue
i.fa.fa-bug
| Bug
@@ -91,4 +91,4 @@ block content
.animated.zoomInDown.delay-half
span.completion-icon.ion-checkmark-circled.text-primary
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
- script(src="/js/lib/coursewares/coursewaresHCJQFramework_0.1.2.js")
+ script(src="/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js")
diff --git a/views/coursewares/showJS.jade b/views/coursewares/showJS.jade
index c32427ca22..815b247ac7 100644
--- a/views/coursewares/showJS.jade
+++ b/views/coursewares/showJS.jade
@@ -67,7 +67,7 @@ block content
form.code
.form-group.codeMirrorView
textarea#codeEditor(autofocus=true, style='display: none;')
- script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.2.js')
+ script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.4.js')
#complete-courseware-dialog.modal(tabindex='-1')
.modal-dialog.animated.zoomIn.fast-animation
.modal-content
diff --git a/views/coursewares/showVideo.jade b/views/coursewares/showVideo.jade
index dd6576b74f..9cd162988d 100644
--- a/views/coursewares/showVideo.jade
+++ b/views/coursewares/showVideo.jade
@@ -23,9 +23,9 @@ block content
.button-spacer
if (user.sentSlackInvite)
.btn-group.input-group.btn-group-justified
- .btn.btn-success.btn-big#i-want-help-editorless
+ .btn.btn-success.btn-big#i-want-help-editorless(disabled)
i.fa.fa-medkit
- | Get help
+ | Get help(disabled)
.btn.btn-success.btn-big#report-issue
i.fa.fa-bug
| Report a bug
diff --git a/views/coursewares/showZiplineOrBasejump.jade b/views/coursewares/showZiplineOrBasejump.jade
index f1b91cdd10..dbf5c103a1 100644
--- a/views/coursewares/showZiplineOrBasejump.jade
+++ b/views/coursewares/showZiplineOrBasejump.jade
@@ -21,9 +21,9 @@ block content
if (user.sentSlackInvite)
.button-spacer
.btn-group.input-group.btn-group-justified
- .btn.btn-success.btn-big#i-want-help-editorless
+ .btn.btn-success.btn-big#i-want-help-editorless(disabled)
i.fa.fa-medkit
- | Help
+ | Help(disabled)
.btn.btn-success.btn-big#i-want-to-pair
i.fa.fa-user-plus
| Pair
diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade
index d8f766fcbf..f237d24167 100644
--- a/views/partials/navbar.jade
+++ b/views/partials/navbar.jade
@@ -23,7 +23,7 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
a(href='/chat', target='_blank') Chat
else
li
- a(href='/challenges/join-our-chat-room') Chat
+ a(href='/challenges/waypoint-join-our-chat-room') Chat
li
a(href='/news') News
li
diff --git a/views/partials/universal-head.jade b/views/partials/universal-head.jade
index 81b2895666..205a27e0ce 100644
--- a/views/partials/universal-head.jade
+++ b/views/partials/universal-head.jade
@@ -32,7 +32,7 @@ script.
window.moment || document.write('