diff --git a/controllers/resources.js b/controllers/resources.js index 3a7e096b74..6f3951f9cb 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -21,6 +21,17 @@ var async = require('async'), * Resources. */ +Array.zip = function(left, right, combinerFunction) { + var counter, + results = []; + + for (counter = 0; counter < Math.min(left.length, right.length); counter++) { + results.push(combinerFunction(left[counter],right[counter])); + } + + return results; +}; + module.exports = { privacy: function privacy(req, res) { res.render('resources/privacy', { @@ -195,6 +206,25 @@ module.exports = { req.user.progressTimestamps.push(challengesHash[key]); } } + + var timeStamps = []; + R.keys(req.user.challengesHash).forEach(function(key) { + "use strict"; + timeStamps.push({timeStamp: challengesHash[key]}); + }); + + req.user.completedCoursewares = Array.zip(timeStamps, coursewares, + function(left, right) { + "use strict"; + return ({ + completedDate: left.timeStamp, + _id: right._id, + name: right.name + }); + }).filter(function(elem) { + "use strict"; + return elem.completedDate !== 0; + }); req.user.pointsNeedMigration = false; req.user.save(); } diff --git a/models/User.js b/models/User.js index 09f6a069a3..33d19618cc 100644 --- a/models/User.js +++ b/models/User.js @@ -240,30 +240,6 @@ var userSchema = new mongoose.Schema({ 53: { type: Number, default: 0 - }, - 54: { - type: Number, - default: 0 - }, - 55: { - type: Number, - default: 0 - }, - 56: { - type: Number, - default: 0 - }, - 57: { - type: Number, - default: 0 - }, - 58: { - type: Number, - default: 0 - }, - 59: { - type: Number, - default: 0 } }, profile: { diff --git a/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js b/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js index d7928afc20..0234b5d314 100644 --- a/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js +++ b/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js @@ -3,12 +3,11 @@ */ var widgets = []; -var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("codeEditor"), { +var editor = CodeMirror.fromTextArea(document.getElementById("codeEditor"), { lineNumbers: true, mode: "text/html", theme: 'monokai', runnable: true, - //lint: true, matchBrackets: true, autoCloseBrackets: true, scrollbarStyle: 'null', @@ -16,7 +15,6 @@ var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("codeEditor") gutters: ["CodeMirror-lint-markers"], onKeyEvent: doLinting }); -var editor = myCodeMirror; // Hijack tab key to insert two spaces instead @@ -117,7 +115,7 @@ var allSeeds = ''; }); })(); -myCodeMirror.setValue(allSeeds); +editor.setValue('test'); function doLinting () { editor.operation(function () { diff --git a/views/account/show.jade b/views/account/show.jade index 911d316cdd..fecdcae731 100644 --- a/views/account/show.jade +++ b/views/account/show.jade @@ -95,11 +95,6 @@ block content a.btn.btn-lg.btn-block.btn-info(href=website3Link, target='_blank') i.fa.icon-beaker | Try it out - // - html. - - - .hidden-xs.col-sm-12 #cal-heatmap