Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IcarusServer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
icarus
IcarusServer
Commits
5bae4b56
Commit
5bae4b56
authored
8 years ago
by
andreagerino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding explorations endpoint
parent
9f22d44c
dockerize
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
invisiblepuzzle.js
routes/services/invisiblepuzzle/invisiblepuzzle.js
+49
-0
No files found.
routes/services/invisiblepuzzle/invisiblepuzzle.js
View file @
5bae4b56
...
@@ -114,6 +114,55 @@ router.get('/users/sighted', function(req, res, next) {
...
@@ -114,6 +114,55 @@ router.get('/users/sighted', function(req, res, next) {
});
});
router
.
get
(
'/explorations/headphones'
,
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
{
$group
:
{
"_id"
:
1
,
"explorations"
:
{
"$sum"
:
1
},
"with_hp"
:
{
"$sum"
:
{
"$cond"
:
[
{
"$eq"
:
[
"$userdata.headphones"
,
true
]
},
1
,
0
]
}
}
}
}
]
);
return_cursor
(
cursor
,
req
,
res
,
next
);
});
function
return_cursor
(
cursor
,
req
,
res
,
next
){
function
return_cursor
(
cursor
,
req
,
res
,
next
){
cursor
.
toArray
(
function
(
err
,
result
)
{
cursor
.
toArray
(
function
(
err
,
result
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment