dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20528
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9399: Added no of days in period to period resource table
------------------------------------------------------------
revno: 9399
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-12-26 10:09:06 +0100
message:
Added no of days in period to period resource table
modified:
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.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-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2012-12-25 22:34:59 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2012-12-26 09:09:06 +0000
@@ -63,6 +63,7 @@
import org.hisp.dhis.resourcetable.statement.CreateDataElementGroupSetTableStatement;
import org.hisp.dhis.resourcetable.statement.CreateIndicatorGroupSetTableStatement;
import org.hisp.dhis.resourcetable.statement.CreateOrganisationUnitGroupSetTableStatement;
+import org.hisp.dhis.system.util.DateUtils;
import static org.hisp.dhis.resourcetable.ResourceTableStore.*;
@@ -469,8 +470,11 @@
final List<String> values = new ArrayList<String>();
+ int days = DateUtils.daysBetween( period.getStartDate(), period.getEndDate() ) + 1;
+
values.add( String.valueOf( period.getId() ) );
values.add( period.getIsoDate() );
+ values.add( String.valueOf( days ) );
for ( PeriodType periodType : PeriodType.PERIOD_TYPES )
{
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java 2012-12-25 22:34:59 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java 2012-12-26 09:09:06 +0000
@@ -240,7 +240,7 @@
// Do nothing, table does not exist
}
- String sql = "CREATE TABLE " + tableName + " (periodid INTEGER NOT NULL PRIMARY KEY, iso VARCHAR(10)";
+ String sql = "CREATE TABLE " + tableName + " (periodid INTEGER NOT NULL PRIMARY KEY, iso VARCHAR(10) NOT NULL, daysno INTEGER NOT NULL";
for ( PeriodType periodType : PeriodType.PERIOD_TYPES )
{