diff --git a/routes/services/invisiblepuzzle/invisiblepuzzle.js b/routes/services/invisiblepuzzle/invisiblepuzzle.js index 347cc59c9cbbeac56876e39b9f2f42368d97b15a..61df7c5c6590fafc417c9a0b14d1347f1e1624d5 100644 --- a/routes/services/invisiblepuzzle/invisiblepuzzle.js +++ b/routes/services/invisiblepuzzle/invisiblepuzzle.js @@ -296,6 +296,49 @@ router.get('/explorations/hpbylevel', function(req, res, next) { }); +router.get('/sonifications/bylevel', function(req, res, next) { + + var collection = icarusDb.collection('resources'); + + var cursor = collection.aggregate( + + // Pipeline + [ + // Stage 1 + { + $match: { + "appdata.appname" : "Invisible Puzzle", + "userdata.event" : "exploration", + "debug" : false + } + }, + + // Stage 2 + { + $project: { + "identifier": { + "lvl": "$userdata.level.id", + "son": "$userdata.sonification" + } + } + }, + + // Stage 3 + { + $group: { + "_id": "$identifier", + "count": {$sum: 1} + } + } + + ] + + ); + + return_cursor(cursor, req, res, next); + +}); + function return_cursor(cursor, req, res, next){ cursor.toArray(function(err, result) {