dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24826
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12225: Analytics, added period type column to event analytics tables
------------------------------------------------------------
revno: 12225
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-24 11:29:24 +0200
message:
Analytics, added period type column to event analytics tables
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java
--
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-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2013-09-02 18:12:51 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2013-09-24 09:29:24 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientIdentifierType;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.system.util.DateUtils;
@@ -160,6 +161,7 @@
"left join patient pa on pi.patientid=pa.patientid " +
"left join organisationunit ou on psi.organisationunitid=ou.organisationunitid " +
"left join _orgunitstructure ous on psi.organisationunitid=ous.organisationunitid " +
+ "left join _dateperiodstructure dps on psi.executiondate=dps.dateperiod " +
"where psi.executiondate >= '" + start + "' " +
"and psi.executiondate <= '" + end + "' " +
"and pr.programid=" + table.getProgram().getId() + ";";
@@ -185,6 +187,15 @@
String[] col = { column, "character(11)", "ous." + column };
columns.add( col );
}
+
+ List<PeriodType> periodTypes = PeriodType.getAvailablePeriodTypes();
+
+ for ( PeriodType periodType : periodTypes )
+ {
+ String column = periodType.getName().toLowerCase();
+ String[] col = { column, "character varying(10)", "dps." + column };
+ columns.add( col );
+ }
for ( DataElement dataElement : table.getProgram().getAllDataElements() )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java 2013-09-17 16:22:09 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java 2013-09-24 09:29:24 +0000
@@ -56,6 +56,7 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
@@ -108,6 +109,9 @@
@Autowired
private DimensionService dimensionService;
+
+ @Autowired
+ private UserService userService;
@Autowired
private ContextUtils contextUtils;
@@ -237,6 +241,10 @@
private void mergeMap( Map map )
{
+ if ( map.getUser() != null )
+ {
+ map.setUser( userService.getUser( map.getUser().getUid() ) );
+ }
}
private void mergeMapView( MapView view )