dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25689
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12783: Data statistics, added number of users logged in during last hour. This gives a pretty good indic...
------------------------------------------------------------
revno: 12783
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-21 19:17:16 +0200
message:
Data statistics, added number of users logged in during last hour. This gives a pretty good indication of no of currently logged in users.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/statistics/GetStatisticsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseStatistics.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java 2013-09-25 18:09:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java 2013-10-21 17:17:16 +0000
@@ -235,6 +235,8 @@
int getInactiveUsersCount( int months );
int getActiveUsersCount( int days );
+
+ int getActiveUsersCount( Date since );
// -------------------------------------------------------------------------
// UserAuthorityGroup
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2013-09-25 18:09:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2013-10-21 17:17:16 +0000
@@ -501,6 +501,11 @@
return userCredentialsStore.getActiveUsersCount( cal.getTime() );
}
+
+ public int getActiveUsersCount( Date since )
+ {
+ return userCredentialsStore.getActiveUsersCount( since );
+ }
// -------------------------------------------------------------------------
// UserSettings
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/statistics/GetStatisticsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/statistics/GetStatisticsAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/statistics/GetStatisticsAction.java 2013-10-21 17:17:16 +0000
@@ -28,9 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.Calendar;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
+import org.hisp.dhis.period.Cal;
import org.hisp.dhis.statistics.StatisticsProvider;
import org.hisp.dhis.common.Objects;
import org.hisp.dhis.datavalue.DataValueService;
@@ -105,10 +108,13 @@
{
Map<Objects, Integer> counts = statisticsProvider.getObjectCounts();
+ Date lastHour = new Cal().now().subtract( Calendar.HOUR_OF_DAY, 1 ).time();
+
objects = new EnumMapWrapper<Objects, Integer>( Objects.class, counts );
- activeUsers.put( 0, userService.getActiveUsersCount( 0 ) );
- activeUsers.put( 1, userService.getActiveUsersCount( 1 ) );
+ activeUsers.put( 0, userService.getActiveUsersCount( lastHour ) );
+ activeUsers.put( 1, userService.getActiveUsersCount( 0 ) );
+ activeUsers.put( 2, userService.getActiveUsersCount( 1 ) );
activeUsers.put( 7, userService.getActiveUsersCount( 7 ) );
activeUsers.put( 30, userService.getActiveUsersCount( 30 ) );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2013-10-16 11:58:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2013-10-21 17:17:16 +0000
@@ -336,4 +336,5 @@
locale_language_no_translation=Please select a language
locale_country_no_translation=Please select a country
data_monitoring=Data monitoring
-data_monitoring_strategy=Data monitoring strategy
\ No newline at end of file
+data_monitoring_strategy=Data monitoring strategy
+last_hour=Last hour
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseStatistics.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseStatistics.vm 2012-07-12 12:39:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseStatistics.vm 2013-10-21 17:17:16 +0000
@@ -62,15 +62,19 @@
<th style="width:200px">$i18n.getString( "users_logged_in" )</th>
<th style="width:200px">$i18n.getString( "number" )</th>
</tr>
+ <tr>
+ <td>$i18n.getString( "last_hour" )</td>
+ <td>$activeUsers.get( 0 )</td>
+ </tr>
<tr>
<td>$i18n.getString( "today" )</td>
- <td>$activeUsers.get( 0 )</td>
- </tr>
- <tr>
- <td>$i18n.getString( "yesterday" )</td>
<td>$activeUsers.get( 1 )</td>
</tr>
<tr>
+ <td>$i18n.getString( "yesterday" )</td>
+ <td>$activeUsers.get( 2 )</td>
+ </tr>
+ <tr>
<td>$i18n.getString( "last_7_days" )</td>
<td>$activeUsers.get( 7 )</td>
</tr>