Merge pull request #6601 from SaintPeter/feature/challenge-checksum

Add Checksum to Challenges for Google Analytics
This commit is contained in:
Berkeley Martinez
2016-01-31 17:36:16 -08:00
14 changed files with 32 additions and 5 deletions

View File

@@ -178,7 +178,10 @@ function getRenderData$(user, challenge$, origChallengeName, solution) {
// htmls specific
verb: randomVerb(),
phrase: randomPhrase(),
compliment: randomCompliment()
compliment: randomCompliment(),
// Google Analytics
gaName: challenge.title + '~' + challenge.checksum
}
});
});

View File

@@ -1,5 +1,6 @@
import path from 'path';
import { Observable } from 'rx';
import adler32 from 'adler32';
const basePath = process.cwd() + '/seed/challenges/';
@@ -21,6 +22,12 @@ export default function getFromDisk$(challenge) {
return _challenge;
})
.map(challenge => {
challenge.checksum = adler32.sum(
Buffer(challenge.title +
JSON.stringify(challenge.description) +
JSON.stringify(challenge.challengeSeed) +
JSON.stringify(challenge.tests)));
challenge.head = challenge.head || [];
challenge.tail = challenge.tail || [];
challenge.challengeType = '' + challenge.challengeType;

View File

@@ -93,6 +93,7 @@ block content
common.challengeType = !{JSON.stringify(challengeType)};
common.dashedName = !{JSON.stringify(dashedName)};
common.isCompleted = !{JSON.stringify(isCompleted)};
common.gaName = !{JSON.stringify(gaName)};
common.username = !{JSON.stringify(user && user.username || '')};

View File

@@ -84,6 +84,7 @@ block content
common.challengeType = !{JSON.stringify(challengeType)};
common.dashedName = !{JSON.stringify(dashedName)};
common.isCompleted = !{JSON.stringify(isCompleted)};
common.gaName = !{JSON.stringify(gaName)};
common.username = !{JSON.stringify(user && user.username || '')};

View File

@@ -88,6 +88,7 @@ block content
common.challengeType = !{JSON.stringify(challengeType)};
common.dashedName = !{JSON.stringify(dashedName)};
common.isCompleted = !{JSON.stringify(isCompleted)};
common.gaName = !{JSON.stringify(gaName)};
common.username = !{JSON.stringify(user && user.username || '')};

View File

@@ -49,6 +49,7 @@ block content
common.challengeName = !{JSON.stringify(name)};
common.challengeType = !{JSON.stringify(challengeType)};
common.dashedName = !{JSON.stringify(dashedName || '')};
common.gaName = !{JSON.stringify(gaName)};
common.isHonest = !{JSON.stringify(isHonest || false)};
common.isFrontEndCert = !{JSON.stringify(isFrontEndCert || false)};
common.isFullStackCert = !{JSON.stringify(isFullStackCert || false)};

View File

@@ -56,6 +56,7 @@ block content
common.challengeName = !{JSON.stringify(name)};
common.challengeType = !{JSON.stringify(challengeType)};
common.dashedName = !{JSON.stringify(dashedName)};
common.gaName = !{JSON.stringify(gaName)};
common.init.push(function($) {
function controlEnterHandler(e) {
if (

View File

@@ -68,6 +68,7 @@ block content
common.challengeId = !{JSON.stringify(id)};
common.challengeName = !{JSON.stringify(name)};
common.dashedName = !{JSON.stringify(dashedName)};
common.gaName = !{JSON.stringify(gaName)};
common.challengeType = !{JSON.stringify(challengeType)};
common.controlEnterHandler = function (e) {