Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
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
John Samuel Ako Deutesfeld
ARSnova Backend
Commits
25d166d4
Commit
25d166d4
authored
10 years ago
by
Paul-Christian Volkmer
Browse files
Options
Downloads
Patches
Plain Diff
Add logged in user count to statistics
parent
add529b9
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/entities/Statistics.java
+11
-1
11 additions, 1 deletion
src/main/java/de/thm/arsnova/entities/Statistics.java
src/main/java/de/thm/arsnova/services/StatisticsService.java
+7
-3
7 additions, 3 deletions
src/main/java/de/thm/arsnova/services/StatisticsService.java
with
18 additions
and
4 deletions
src/main/java/de/thm/arsnova/entities/Statistics.java
+
11
−
1
View file @
25d166d4
...
@@ -7,6 +7,7 @@ public class Statistics {
...
@@ -7,6 +7,7 @@ public class Statistics {
private
int
openSessions
;
private
int
openSessions
;
private
int
closedSessions
;
private
int
closedSessions
;
private
int
activeUsers
;
private
int
activeUsers
;
private
int
loggedinUsers
;
public
int
getAnswers
()
{
public
int
getAnswers
()
{
return
answers
;
return
answers
;
...
@@ -43,6 +44,13 @@ public class Statistics {
...
@@ -43,6 +44,13 @@ public class Statistics {
this
.
activeUsers
=
activeUsers
;
this
.
activeUsers
=
activeUsers
;
}
}
public
int
getLoggedinUsers
()
{
return
loggedinUsers
;
}
public
void
setLoggedinUsers
(
final
int
loggedinUsers
)
{
this
.
loggedinUsers
=
loggedinUsers
;
}
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
(
this
.
getClass
().
getName
()
return
(
this
.
getClass
().
getName
()
...
@@ -50,7 +58,9 @@ public class Statistics {
...
@@ -50,7 +58,9 @@ public class Statistics {
+
answers
+
answers
+
closedSessions
+
closedSessions
+
openSessions
+
openSessions
+
questions
).
hashCode
();
+
questions
+
loggedinUsers
).
hashCode
();
}
}
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
src/main/java/de/thm/arsnova/services/StatisticsService.java
+
7
−
3
View file @
25d166d4
...
@@ -20,25 +20,29 @@ public class StatisticsService implements IStatisticsService {
...
@@ -20,25 +20,29 @@ public class StatisticsService implements IStatisticsService {
@Override
@Override
public
final
int
countActiveUsers
()
{
public
final
int
countActiveUsers
()
{
long
since
=
System
.
currentTimeMillis
()
-
DURATION_IN_MILLIS
;
final
long
since
=
System
.
currentTimeMillis
()
-
DURATION_IN_MILLIS
;
return
databaseDao
.
countActiveUsers
(
since
);
return
databaseDao
.
countActiveUsers
(
since
);
}
}
@Override
@Override
public
int
countLoggedInUsers
()
{
public
int
countLoggedInUsers
()
{
if
(
sessionRegistry
==
null
)
{
return
0
;
}
return
sessionRegistry
.
getAllPrincipals
().
size
();
return
sessionRegistry
.
getAllPrincipals
().
size
();
}
}
@Override
@Override
public
final
Statistics
getStatistics
()
{
public
final
Statistics
getStatistics
()
{
long
since
=
System
.
currentTimeMillis
()
-
DURATION_IN_MILLIS
;
final
long
since
=
System
.
currentTimeMillis
()
-
DURATION_IN_MILLIS
;
Statistics
statistics
=
new
Statistics
();
final
Statistics
statistics
=
new
Statistics
();
statistics
.
setOpenSessions
(
databaseDao
.
countOpenSessions
());
statistics
.
setOpenSessions
(
databaseDao
.
countOpenSessions
());
statistics
.
setClosedSessions
(
databaseDao
.
countClosedSessions
());
statistics
.
setClosedSessions
(
databaseDao
.
countClosedSessions
());
statistics
.
setAnswers
(
databaseDao
.
countAnswers
());
statistics
.
setAnswers
(
databaseDao
.
countAnswers
());
statistics
.
setQuestions
(
databaseDao
.
countQuestions
());
statistics
.
setQuestions
(
databaseDao
.
countQuestions
());
statistics
.
setActiveUsers
(
databaseDao
.
countActiveUsers
(
since
));
statistics
.
setActiveUsers
(
databaseDao
.
countActiveUsers
(
since
));
statistics
.
setLoggedinUsers
(
countLoggedInUsers
());
return
statistics
;
return
statistics
;
}
}
}
}
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