Add Checksum to Challenges for Google Analytics

This commit is contained in:
SaintPeter
2016-01-30 00:13:41 -08:00
parent 7726989f9a
commit 317d8ea9ba

View File

@ -1,6 +1,7 @@
/* eslint-disable no-process-exit */
require('babel-register');
require('dotenv').load();
var adler32 = require('adler32');
var Rx = require('rx'),
_ = require('lodash'),
@ -40,6 +41,12 @@ destroy()
.replace(/\:/g, '')
.replace(/\s/g, '-');
challenge.checksum = adler32.sum(
Buffer(challenge.title +
JSON.stringify(challenge.description) +
JSON.stringify(challenge.challengeSeed) +
JSON.stringify(challenge.tests)));
challenge.fileName = fileName;
challenge.helpRoom = helpRoom;
challenge.order = order;