Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Paul-Christian Volkmer
ARSnova Backend
Commits
d2220a39
Commit
d2220a39
authored
10 years ago
by
Christoph Thelen
Browse files
Options
Downloads
Patches
Plain Diff
Fix for #15354: Count unique users who answered questions
parent
afd8ba1c
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
+12
-0
12 additions, 0 deletions
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
src/main/java/de/thm/arsnova/entities/Statistics.java
+9
-0
9 additions, 0 deletions
src/main/java/de/thm/arsnova/entities/Statistics.java
with
21 additions
and
0 deletions
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
+
12
−
0
View file @
d2220a39
...
...
@@ -1080,11 +1080,14 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware
try
{
final
View
statsView
=
new
View
(
"statistics/statistics"
);
final
View
creatorView
=
new
View
(
"statistics/unique_session_creators"
);
final
View
studentUserView
=
new
View
(
"statistics/active_student_users"
);
statsView
.
setGroup
(
true
);
creatorView
.
setGroup
(
true
);
studentUserView
.
setGroup
(
true
);
final
ViewResults
statsResults
=
getDatabase
().
view
(
statsView
);
final
ViewResults
creatorResults
=
getDatabase
().
view
(
creatorView
);
final
ViewResults
studentUserResults
=
getDatabase
().
view
(
studentUserView
);
if
(!
isEmptyResults
(
statsResults
))
{
final
JSONArray
rows
=
statsResults
.
getJSONArray
(
"rows"
);
...
...
@@ -1125,6 +1128,15 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware
}
stats
.
setCreators
(
creators
.
size
());
}
if
(!
isEmptyResults
(
studentUserResults
))
{
final
JSONArray
rows
=
studentUserResults
.
getJSONArray
(
"rows"
);
Set
<
String
>
students
=
new
HashSet
<
String
>();
for
(
int
i
=
0
;
i
<
rows
.
size
();
i
++)
{
final
JSONObject
row
=
rows
.
getJSONObject
(
i
);
students
.
add
(
row
.
getString
(
"key"
));
}
stats
.
setActiveStudents
(
students
.
size
());
}
return
stats
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
error
(
"Error while retrieving session count"
,
e
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/de/thm/arsnova/entities/Statistics.java
+
9
−
0
View file @
d2220a39
...
...
@@ -26,6 +26,7 @@ public class Statistics {
private
int
closedSessions
;
private
int
creators
;
private
int
activeUsers
;
private
int
activeStudents
;
private
int
loggedinUsers
;
private
int
interposedQuestions
;
private
int
conceptQuestions
;
...
...
@@ -118,6 +119,14 @@ public class Statistics {
this
.
conceptQuestions
=
conceptQuestions
;
}
public
int
getActiveStudents
()
{
return
activeStudents
;
}
public
void
setActiveStudents
(
int
activeStudents
)
{
this
.
activeStudents
=
activeStudents
;
}
@Override
public
int
hashCode
()
{
return
(
this
.
getClass
().
getName
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment