dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31744
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16217: Data sync fix
------------------------------------------------------------
revno: 16217
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-07-23 13:34:30 +0200
message:
Data sync fix
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.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-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java 2014-07-12 10:03:43 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java 2014-07-23 11:34:30 +0000
@@ -31,6 +31,7 @@
import static org.apache.commons.lang.StringUtils.trimToNull;
import java.io.IOException;
+import java.util.Calendar;
import java.util.Date;
import org.apache.commons.logging.Log;
@@ -42,6 +43,7 @@
import org.hisp.dhis.dxf2.importsummary.ImportStatus;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
import org.hisp.dhis.dxf2.utils.ImportSummaryResponseExtractor;
+import org.hisp.dhis.period.Cal;
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.system.util.CodecUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -229,11 +231,13 @@
/**
* Gets the time of the last successful synchronization operation. If not set,
- * the current time is returned.
+ * the current date subtracted three days is returned.
*/
private Date getLastSynchSuccess()
{
- return (Date) systemSettingManager.getSystemSetting( KEY_LAST_SUCCESSFUL_SYNC, new Date() );
+ Date fallback = new Cal().subtract( Calendar.DAY_OF_YEAR, 3 ).time();
+
+ return (Date) systemSettingManager.getSystemSetting( KEY_LAST_SUCCESSFUL_SYNC, fallback );
}
/**