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);
|
||||
|
||||
// Erase groups that are not usable
|
||||
var invalid = 0;
|
||||
groups = groups.filter(function(elt) {
|
||||
|
||||
// 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);
|
||||
});
|
||||
|
||||
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.`);
|
||||
|
||||
groups.forEach(function(elt) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
var pg = require('pg');
|
||||
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 = {};
|
||||
|
||||
|
@ -63,7 +63,7 @@ function main() {
|
|||
function(callback) {
|
||||
|
||||
client.query(
|
||||
'SELECT * FROM Experiment;',
|
||||
'SELECT * FROM Experiment WHERE finished;',
|
||||
function(err, result) {
|
||||
experiments = result.rows;
|
||||
callback();
|
||||
|
@ -86,7 +86,7 @@ function main() {
|
|||
users,
|
||||
function(user, callback) {
|
||||
client.query(
|
||||
'SELECT * FROM Experiment WHERE user_id = $1',
|
||||
'SELECT * FROM Experiment WHERE user_id = $1 AND finished',
|
||||
[user.id],
|
||||
function(err, result) {
|
||||
user.experiments = result.rows;
|
||||
|
@ -134,8 +134,8 @@ function main() {
|
|||
experiments,
|
||||
function(exp, callback) {
|
||||
DBReq.getInfo(exp.id, function(result) {
|
||||
exp.elements = result;
|
||||
write('.');
|
||||
exp.elements = result;
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue