-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1855 from opensrp/fix-sync
WCARO Sync fixes and improvements
- Loading branch information
Showing
8 changed files
with
115 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
opensrp-chw/src/main/java/org/smartregister/chw/sync/ChwSyncIntentService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
package org.smartregister.chw.sync; | ||
|
||
import org.smartregister.chw.dao.EventDao; | ||
import org.smartregister.sync.intent.SyncIntentService; | ||
|
||
public class ChwSyncIntentService extends SyncIntentService { | ||
|
||
@Override | ||
protected void handleSync() { | ||
// fetch the last downloaded serverVersion before any unsyced data | ||
Long serverVersion = EventDao.getMinimumVerifiedServerVersion(); | ||
if (serverVersion != null) | ||
org.smartregister.util.Utils.getAllSharedPreferences().saveLastSyncDate(serverVersion); | ||
|
||
// flag all contentious events as unsynced | ||
EventDao.markEventsForReUpload(); | ||
super.handleSync(); | ||
} | ||
|
||
@Override | ||
public int getEventPullLimit() { | ||
return 1000; | ||
} | ||
|
||
|
||
@Override | ||
protected Integer getEventBatchSize(){ | ||
return 250; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters