Corrected some bugs in analysis
This commit is contained in:
parent
f9deb5ff9f
commit
58f6caca40
|
@ -7,10 +7,16 @@ function main(path) {
|
||||||
var groups = lib.makeGroups(db);
|
var groups = lib.makeGroups(db);
|
||||||
|
|
||||||
// Erase groups that are not usable
|
// Erase groups that are not usable
|
||||||
|
var invalid = 0;
|
||||||
groups = groups.filter(function(elt) {
|
groups = groups.filter(function(elt) {
|
||||||
|
|
||||||
// An elt is valid if it contains at least 2 exp, BaseRecommendation included
|
// An elt is valid if it contains at least 2 exp, BaseRecommendation included
|
||||||
return elt.length > 1 && elt.find(function(e) { return e.recommendation_style[4] === 'B'; }) !== undefined;
|
if (elt.length > 1 && elt.find(function(e) { return e.recommendation_style[4] === 'B'; }) !== undefined) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
invalid++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,7 +24,13 @@ function main(path) {
|
||||||
elt.sort(lib.compareRecommendationStyle);
|
elt.sort(lib.compareRecommendationStyle);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`There were ${db.users.length} users for ${db.experiments.length} experiments`);
|
var nbExp = 0;
|
||||||
|
|
||||||
|
groups.forEach(function(elt) {
|
||||||
|
nbExp += elt.length;
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`There were ${db.users.length} users for ${nbExp} experiments (${invalid} invalid)`);
|
||||||
console.log(`There were ${groups.length} groups that were made.`);
|
console.log(`There were ${groups.length} groups that were made.`);
|
||||||
|
|
||||||
groups.forEach(function(elt) {
|
groups.forEach(function(elt) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
var pg = require('pg');
|
var pg = require('pg');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var DBReq = require('../controllers/prototype/dbrequests.js');
|
var DBReq = require('./dbrequests.js');
|
||||||
|
|
||||||
var users, client, release, scenes, coinCombinations, experiments, callback, url, db = {};
|
var users, client, release, scenes, coinCombinations, experiments, callback, url, db = {};
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ function main() {
|
||||||
function(callback) {
|
function(callback) {
|
||||||
|
|
||||||
client.query(
|
client.query(
|
||||||
'SELECT * FROM Experiment;',
|
'SELECT * FROM Experiment WHERE finished;',
|
||||||
function(err, result) {
|
function(err, result) {
|
||||||
experiments = result.rows;
|
experiments = result.rows;
|
||||||
callback();
|
callback();
|
||||||
|
@ -86,7 +86,7 @@ function main() {
|
||||||
users,
|
users,
|
||||||
function(user, callback) {
|
function(user, callback) {
|
||||||
client.query(
|
client.query(
|
||||||
'SELECT * FROM Experiment WHERE user_id = $1',
|
'SELECT * FROM Experiment WHERE user_id = $1 AND finished',
|
||||||
[user.id],
|
[user.id],
|
||||||
function(err, result) {
|
function(err, result) {
|
||||||
user.experiments = result.rows;
|
user.experiments = result.rows;
|
||||||
|
@ -134,8 +134,8 @@ function main() {
|
||||||
experiments,
|
experiments,
|
||||||
function(exp, callback) {
|
function(exp, callback) {
|
||||||
DBReq.getInfo(exp.id, function(result) {
|
DBReq.getInfo(exp.id, function(result) {
|
||||||
exp.elements = result;
|
|
||||||
write('.');
|
write('.');
|
||||||
|
exp.elements = result;
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue