← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18664: Added invitations to data statistics

 

------------------------------------------------------------
revno: 18664
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-03-23 14:31:38 +0100
message:
  Added invitations to data statistics
modified:
  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-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	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/statistics/GetStatisticsAction.java	2015-03-23 13:31:38 +0000
@@ -36,6 +36,8 @@
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.statistics.StatisticsProvider;
 import org.hisp.dhis.system.util.EnumMapWrapper;
+import org.hisp.dhis.user.UserInvitationStatus;
+import org.hisp.dhis.user.UserQueryParams;
 import org.hisp.dhis.user.UserService;
 import org.joda.time.DateTime;
 
@@ -89,14 +91,21 @@
     {
         return activeUsers;
     }
-    
+
+    private EnumMapWrapper<UserInvitationStatus, Integer> userInvitations;
+
+    public EnumMapWrapper<UserInvitationStatus, Integer> getUserInvitations()
+    {
+        return userInvitations;
+    }
+
     private Map<Integer, Integer> dataValueCount = new HashMap<>();
 
     public Map<Integer, Integer> getDataValueCount()
     {
         return dataValueCount;
     }
-
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -117,6 +126,18 @@
         activeUsers.put( 7, userService.getActiveUsersCount( 7 ) );
         activeUsers.put( 30, userService.getActiveUsersCount( 30 ) );
         
+        Map<UserInvitationStatus, Integer> invitations = new HashMap<>();
+        
+        UserQueryParams inviteAll = new UserQueryParams();
+        inviteAll.setInvitationStatus( UserInvitationStatus.ALL );
+        invitations.put( UserInvitationStatus.ALL, userService.getUserCount( inviteAll ) );
+
+        UserQueryParams inviteExpired = new UserQueryParams();
+        inviteExpired.setInvitationStatus( UserInvitationStatus.EXPIRED );
+        invitations.put( UserInvitationStatus.EXPIRED, userService.getUserCount( inviteExpired ) );             
+        
+        userInvitations = new EnumMapWrapper<>( UserInvitationStatus.class, invitations );
+        
         dataValueCount.put( 0, dataValueService.getDataValueCount( 0 ) );
         dataValueCount.put( 1, dataValueService.getDataValueCount( 1 ) );
         dataValueCount.put( 7, dataValueService.getDataValueCount( 7 ) );

=== 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	2015-03-19 03:43:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2015-03-23 13:31:38 +0000
@@ -380,4 +380,7 @@
 org_unit_group_does_not_exist=Org unit group does not exist
 duplicate_periods=Duplicate periods
 remove_expired_invitations=Remove expired invitations
-view_name=View name
\ No newline at end of file
+view_name=View name
+user_account_invitations=User account invitations
+pending_invitations=Pending invitations
+expired_invitations=Expired invitations
\ 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	2015-03-19 15:03:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseStatistics.vm	2015-03-23 13:31:38 +0000
@@ -93,6 +93,24 @@
 
 <table>
 	<tr>
+		<th style="width:200px">$i18n.getString( "user_account_invitations" )</th>
+		<th style="width:200px">$i18n.getString( "number" )</th>
+	</tr>
+    <tr>
+        <td>$i18n.getString( "pending_invitations" )</td>
+        <td>$userInvitations.getValue( "ALL" )</td>
+    </tr>
+    <tr>
+        <td>$i18n.getString( "expired_invitations" )</td>
+        <td>$userInvitations.getValue( "EXPIRED" )</td>
+    </tr>
+    <tr>
+    	<td colspan="2" style="height:15px"></td>
+    </tr>
+</table>
+
+<table>
+	<tr>
 		<th style="width:200px">$i18n.getString( "data_values" )</th>
 		<th style="width:200px">$i18n.getString( "number" )</th>
 	</tr>