Wiring up analytics for courseware, unifying analytics between coursewares and bonfires, general housekeeping tasks for live push
This commit is contained in:
@ -161,7 +161,6 @@ exports.generateChallenge = function(req, res) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.completedCourseware = function (req, res) {
|
exports.completedCourseware = function (req, res) {
|
||||||
debug('In post call with data from req', req);
|
|
||||||
|
|
||||||
var isCompletedDate = Math.round(+new Date() / 1000);
|
var isCompletedDate = Math.round(+new Date() / 1000);
|
||||||
var coursewareHash = req.body.coursewareInfo.coursewareHash;
|
var coursewareHash = req.body.coursewareInfo.coursewareHash;
|
||||||
@ -182,7 +181,6 @@ exports.completedCourseware = function (req, res) {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
if (user) {
|
if (user) {
|
||||||
debug('Saving user');
|
|
||||||
res.send(true)
|
res.send(true)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -114,7 +114,7 @@ $('#submitButton').on('click', function () {
|
|||||||
|
|
||||||
function bonfireExecute() {
|
function bonfireExecute() {
|
||||||
attempts++;
|
attempts++;
|
||||||
ga('send', 'event', 'Bonfire', 'ran-code', bonfireName);
|
ga('send', 'event', 'Bonfire', 'ran-code', challengeName);
|
||||||
userTests= null;
|
userTests= null;
|
||||||
$('#codeOutput').empty();
|
$('#codeOutput').empty();
|
||||||
var userJavaScript = myCodeMirror.getValue();
|
var userJavaScript = myCodeMirror.getValue();
|
||||||
@ -239,8 +239,7 @@ var runTests = function(err, data) {
|
|||||||
|
|
||||||
function showCompletion() {
|
function showCompletion() {
|
||||||
var time = Math.floor(Date.now() / 1000) - started;
|
var time = Math.floor(Date.now() / 1000) - started;
|
||||||
console.log(time);
|
ga('send', 'event', 'Challenge', 'solved', challengeName + ', Time: ' + time +', Attempts: ' + attempts);
|
||||||
ga('send', 'event', 'Bonfire', 'solved', bonfireName + ', Time: ' + time +', Attempts: ' + attempts);
|
|
||||||
$('#complete-bonfire-dialog').modal('show');
|
$('#complete-bonfire-dialog').modal('show');
|
||||||
$('#complete-bonfire-dialog').keydown(function(e) {
|
$('#complete-bonfire-dialog').keydown(function(e) {
|
||||||
if (e.ctrlKey && e.keyCode == 13) {
|
if (e.ctrlKey && e.keyCode == 13) {
|
||||||
|
@ -43,6 +43,12 @@ var libraryIncludes = "<script src='//ajax.googleapis.com/ajax/libs/jquery/2.1.3
|
|||||||
"<link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'/>" +
|
"<link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'/>" +
|
||||||
"<style>body { padding: 0px 3px 0px 3px; }</style>";
|
"<style>body { padding: 0px 3px 0px 3px; }</style>";
|
||||||
|
|
||||||
|
var allTests = '';
|
||||||
|
(function() {
|
||||||
|
tests.forEach(function(elem) {
|
||||||
|
allTests += elem + ' ';
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
var otherTestsForNow = "<script src='/js/lib/coursewares/iFrameScripts.js'></script>";
|
var otherTestsForNow = "<script src='/js/lib/coursewares/iFrameScripts.js'></script>";
|
||||||
|
|
||||||
@ -112,10 +118,12 @@ function doLinting () {
|
|||||||
|
|
||||||
|
|
||||||
function showCompletion() {
|
function showCompletion() {
|
||||||
|
var time = Math.floor(Date.now() / 1000) - started;
|
||||||
|
ga('send', 'event', 'Challenge', 'solved', challengeName + ', Time: ' + time);
|
||||||
$('#complete-courseware-dialog').modal('show');
|
$('#complete-courseware-dialog').modal('show');
|
||||||
$('#complete-courseware-dialog').keydown(function(e) {
|
$('#complete-courseware-dialog').keydown(function(e) {
|
||||||
if (e.ctrlKey && e.keyCode == 13) {
|
if (e.ctrlKey && e.keyCode == 13) {
|
||||||
$('.next-courseware-button').click();
|
$('.next-courseware-button').click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
try {
|
try {
|
||||||
eval(parent.allTests);
|
eval(parent.allTests);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
|
||||||
allTestsGood = false;
|
allTestsGood = false;
|
||||||
} finally {
|
} finally {
|
||||||
if (allTestsGood) {
|
if (allTestsGood) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if (bonfireName) {
|
challengeName = challengeName || 'Untitled';
|
||||||
ga('send', 'event', 'Bonfire', 'load', bonfireName + ':' + Math.floor(Date.now() / 1000));
|
if (challengeName) {
|
||||||
|
ga('send', 'event', 'Challenge', 'load', challengeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
var CSRF_HEADER = 'X-CSRF-Token';
|
var CSRF_HEADER = 'X-CSRF-Token';
|
||||||
@ -107,7 +108,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// Bonfire instructions functions
|
// Bonfire instructions functions
|
||||||
$('#more-info').on('click', function() {
|
$('#more-info').on('click', function() {
|
||||||
ga('send', 'event', 'Bonfire', 'more-info', bonfireName);
|
ga('send', 'event', 'Challenge', 'more-info', challengeName);
|
||||||
$('#brief-instructions').hide();
|
$('#brief-instructions').hide();
|
||||||
$('#long-instructions').show().removeClass('hide');
|
$('#long-instructions').show().removeClass('hide');
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ block content
|
|||||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||||
var challengeEntryPoint = !{JSON.stringify(challengeEntryPoint)};
|
var challengeEntryPoint = !{JSON.stringify(challengeEntryPoint)};
|
||||||
var passedBonfireHash = !{JSON.stringify(bonfireHash)};
|
var passedBonfireHash = !{JSON.stringify(bonfireHash)};
|
||||||
var bonfireName = !{JSON.stringify(name)};
|
var challengeName = !{JSON.stringify(name)};
|
||||||
var started = Math.floor(Date.now() / 1000);
|
var started = Math.floor(Date.now() / 1000);
|
||||||
.col-xs-12.col-sm-12.col-md-8
|
.col-xs-12.col-sm-12.col-md-8
|
||||||
#mainEditorPanel
|
#mainEditorPanel
|
||||||
|
@ -6,7 +6,7 @@ block content
|
|||||||
.panel-heading.text-center
|
.panel-heading.text-center
|
||||||
h1 #{name} (takes #{time} minutes)
|
h1 #{name} (takes #{time} minutes)
|
||||||
script.
|
script.
|
||||||
var bonfireName = null;
|
var challengeName = null;
|
||||||
.panel.panel-body
|
.panel.panel-body
|
||||||
.embed-responsive.embed-responsive-16by9
|
.embed-responsive.embed-responsive-16by9
|
||||||
iframe.embed-responsive-item(src='//player.vimeo.com/video/#{video}')
|
iframe.embed-responsive-item(src='//player.vimeo.com/video/#{video}')
|
||||||
|
@ -52,7 +52,9 @@ block content
|
|||||||
var tests = !{JSON.stringify(tests)};
|
var tests = !{JSON.stringify(tests)};
|
||||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||||
var passedCoursewareHash = !{JSON.stringify(coursewareHash)};
|
var passedCoursewareHash = !{JSON.stringify(coursewareHash)};
|
||||||
|
var challengeName = !{JSON.stringify(name)};
|
||||||
var prodOrDev = !{JSON.stringify(environment)};
|
var prodOrDev = !{JSON.stringify(environment)};
|
||||||
|
var started = Math.floor(Date.now() / 1000);
|
||||||
.col-xs-12.col-sm-12.col-md-5.col-lg-6
|
.col-xs-12.col-sm-12.col-md-5.col-lg-6
|
||||||
#mainEditorPanel
|
#mainEditorPanel
|
||||||
form.code
|
form.code
|
||||||
|
Reference in New Issue
Block a user