Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MilderJoghurt
rlf-server
Commits
fa86bb3d
Commit
fa86bb3d
authored
Jun 23, 2015
by
Fjen Undso
Browse files
VoteController: add currentuser counting to stats
parent
26aef3ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/VoteController.java
View file @
fa86bb3d
package
controllers
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
models.Session
;
...
...
@@ -84,11 +85,16 @@ public class VoteController extends Controller {
VoteStats
sUnderstandability
=
new
VoteStats
(
VoteStats
.
Type
.
UNDERSTANDABILITY
,
0
);
VoteStats
sRequests
=
new
VoteStats
(
VoteStats
.
Type
.
REQUEST
,
0
);
VoteStats
sUsers
=
new
VoteStats
(
VoteStats
.
Type
.
CURRENTUSERS
,
0
);
List
<
VoteStats
>
vsList
=
new
ArrayList
<
VoteStats
>();
vsList
.
add
(
sAll
);
vsList
.
add
(
sSpeed
);
vsList
.
add
(
sUnderstandability
);
vsList
.
add
(
sRequests
);
vsList
.
add
(
sUsers
);
// distinct list of vote owners
HashSet
<
String
>
userIDs
=
new
HashSet
<
String
>();
// generate statistics
for
(
Vote
v
:
session
.
votes
)
{
...
...
@@ -109,7 +115,9 @@ public class VoteController extends Controller {
default
:
break
;
}
userIDs
.
add
(
v
.
owner
);
}
sUsers
.
value
=
userIDs
.
size
();
return
ok
(
Json
.
toJson
(
vsList
));
// 200
}
...
...
Write
Preview
Supports
Markdown
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