Skip to content

Commit 452f4ae

Browse files
committed
normalize # of fields in analytic data being sent to the server. Log masks for analytic data;
1 parent ebc96c9 commit 452f4ae

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

client/app/controllers/clientController.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
3131
mouse_positions: [],
3232
time_ms: 0,
3333
}
34+
/*
35+
[ [ [], [], ..., [] ],
36+
[ [], [], ..., [] ],
37+
[ [], [], ..., [] ],
38+
[ [], [], ..., [] ],
39+
]
40+
*/
41+
42+
// define mouse_positions as 100x1000 array
43+
for (var i = 0; i < 100; i++) {
44+
analytics.mouse_positions.push([]);
45+
for (var k = 0; k < 1000; k++) {
46+
analytics.mouse_positions[i].push([0])
47+
}
48+
}
3449

3550
document.addEventListener('mousemove', handleMouseMove, false);
3651
function getPos(event) {
@@ -61,10 +76,12 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
6176
function handleMouseMove(event) {
6277
// y coord should potentially be mult. by 100
6378
// to account for difference in x, y page size
79+
6480
var pos = getPos(event);
6581
var x = Math.floor(pos[0] * 100);
6682
var y = Math.floor(pos[1] * 1000);
67-
analytics['mouse_positions'].push([x,y]);
83+
//each array stores # of hits at this area
84+
analytics['mouse_positions'][x][y]++;
6885
}
6986

7087
let startDate = new Date();
@@ -418,6 +435,8 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
418435
var analytic_data = analytic_shares['data'];
419436
var analytic_mask = analytic_shares['mask'];
420437

438+
console.log("analytic data", analytic_data);
439+
console.log("analytic masks", analytic_mask);
421440
// Correlation using modified small pairwise 'hypercubes'. (one cube for each pair of questions)
422441
// For every pair of questions, compute and encrypt the two chosen answers.
423442
var pairwise_hypercubes = {};
@@ -447,8 +466,6 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
447466
pairwise_hypercubes = mpc.encryptWithKey(pairwise_hypercubes, public_key);
448467
questions_public = mpc.encryptWithKey(questions_public, public_key); // This encrypts the public answers to questions
449468

450-
console.log('data', analytic_data);
451-
console.log('mask!',analytic_mask);
452469
var submission = {
453470
data: data,
454471
mask: mask,
@@ -460,7 +477,6 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
460477
session: session
461478
};
462479

463-
//console.log(submission);
464480

465481
return $.ajax({
466482
type: 'POST',

0 commit comments

Comments
 (0)