2015-10-12 09:30:48 +02:00
|
|
|
#!/usr/bin/node
|
2015-10-07 16:59:10 +02:00
|
|
|
var lib = require('./lib.js');
|
2015-10-07 14:13:20 +02:00
|
|
|
|
2015-10-02 14:44:38 +02:00
|
|
|
function main(path) {
|
2015-09-14 16:35:16 +02:00
|
|
|
|
2015-10-07 16:59:10 +02:00
|
|
|
var db = lib.loadFromFile(path);
|
|
|
|
var groups = lib.makeGroups(db);
|
2015-09-14 16:35:16 +02:00
|
|
|
|
2015-10-12 09:30:48 +02:00
|
|
|
// Erase groups that are not usable
|
|
|
|
groups = groups.filter(function(elt) {
|
2015-09-28 09:36:49 +02:00
|
|
|
|
2015-10-12 09:30:48 +02:00
|
|
|
// 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;
|
2015-09-28 09:36:49 +02:00
|
|
|
|
2015-10-07 14:13:20 +02:00
|
|
|
});
|
2015-10-02 14:44:38 +02:00
|
|
|
|
2015-10-07 14:13:20 +02:00
|
|
|
groups.forEach(function(elt) {
|
2015-10-12 09:30:48 +02:00
|
|
|
elt.sort(lib.compareRecommendationStyle);
|
2015-10-07 14:13:20 +02:00
|
|
|
});
|
|
|
|
|
2015-10-12 09:30:48 +02:00
|
|
|
console.log(`There were ${db.users.length} users for ${db.experiments.length} experiments`);
|
|
|
|
console.log(`There were ${groups.length} groups that were made.`);
|
2015-10-07 14:13:20 +02:00
|
|
|
|
2015-10-12 09:30:48 +02:00
|
|
|
groups.forEach(function(elt) {
|
|
|
|
console.log(elt.length);
|
2015-10-07 14:13:20 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-10-02 14:44:38 +02:00
|
|
|
if (process.argv.length !== 3) {
|
|
|
|
process.stderr.write('Error : please give me a JSON file to work on\n');
|
|
|
|
process.exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
main(process.argv[2])
|