From a7186bfb70a909a89b657b68bb8cde5a3438c33d Mon Sep 17 00:00:00 2001 From: vend Date: Fri, 27 Jan 2023 16:57:35 +0500 Subject: [PATCH 01/14] added Client Migration for changing the validation status to Invalid --- build.gradle | 2 +- opensrp-chw/build.gradle | 8 ++++---- .../smartregister/chw/repository/ChwRepositoryFlv.java | 7 +++++++ .../java/org/smartregister/chw/util/RepositoryUtils.java | 7 +++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 7187516bb0..359b3f9b6b 100644 --- a/build.gradle +++ b/build.gradle @@ -53,7 +53,7 @@ allprojects { maven { url "https://cloudant.github.io/cloudant-sync-eap/repository" } maven { url 'https://maven.fabric.io/public' } maven { url "https://s3.amazonaws.com/repo.commonsware.com" } - maven { url 'https://nexus.pentaho.org/content/groups/omni/' } + // maven { url 'https://nexus.pentaho.org/content/groups/omni/' } maven { url 'https://dl.bintray.com/ibm-watson-health/ibm-fhir-server-releases' content { diff --git a/opensrp-chw/build.gradle b/opensrp-chw/build.gradle index 7f885101af..8d12b71548 100644 --- a/opensrp-chw/build.gradle +++ b/opensrp-chw/build.gradle @@ -234,7 +234,7 @@ android { versionName "1.0.8" buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10000' - buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' + buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '1' buildConfigField "String", 'opensrp_url', '"https://boresha-afya.smartregister.org/opensrp/"' buildConfigField "String", 'guidebooks_url', '"https://opensrp.s3.amazonaws.com/media/ba/"' buildConfigField "String", 'opensrp_url_debug', '"https://boresha-afya-stage.smartregister.org/opensrp/"' @@ -272,8 +272,8 @@ android { applicationIdSuffix ".drc" versionCode 11 versionName "1.0.16" - buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10000' - buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10000' + buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10' + buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' buildConfigField "String", 'opensrp_url', '"https://wcaro-cd.smartregister.org/opensrp/"' buildConfigField "String", 'guidebooks_url', '"https://opensrp.s3.amazonaws.com/media/drc/"' @@ -286,7 +286,7 @@ android { buildConfigField "String", 'DEFAULT_LOCATION', '"VILLAGE/COMMUNAUTE"' buildConfigField "int", "MAX_CONNECTION_TIMEOUT", '5' buildConfigField "int", "MAX_READ_TIMEOUT", '5' - buildConfigField "int", "DATABASE_VERSION", '12' + buildConfigField "int", "DATABASE_VERSION", '13' } guinea { dimension = 'baseDimension' diff --git a/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index a7075c42af..52f8af9c2a 100644 --- a/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -48,6 +48,9 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 12: upgradeToVersion12(db); break; + case 13: + upgradeToVersion13(db); + break; default: break; } @@ -165,4 +168,8 @@ private static void upgradeToVersion11(SQLiteDatabase db) { private static void upgradeToVersion12(SQLiteDatabase db) { RepositoryUtils.updateNullEventIds(db); } + private static void upgradeToVersion13 (SQLiteDatabase db) + { + RepositoryUtils.updateClientValidateStatus(db); + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java b/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java index abcb2e487f..81f36fa2d7 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java @@ -26,6 +26,8 @@ public interface RepositoryUtils { String EVENT_ID = "id"; String _ID = "_id"; + String VALIDATION_STATUS = "validationStatus"; + String STATUS_INVALID = "Invalid"; String ADD_MISSING_REPORTING_COLUMN = "ALTER TABLE 'indicator_queries' ADD COLUMN expected_indicators TEXT NULL;"; String FAMILY_MEMBER_ADD_REASON_FOR_REGISTRATION = "ALTER TABLE 'ec_family_member' ADD COLUMN reasons_for_registration TEXT NULL;"; @@ -132,4 +134,9 @@ static String getEventId(String jsonString) { return eventId; } + static void updateClientValidateStatus (SQLiteDatabase db) + { + db.execSQL(String.format("UPDATE client Set %s = '%s'",VALIDATION_STATUS,STATUS_INVALID)); + } + } From ef1328f5b76de8a8eb049a76be634d32357f415e Mon Sep 17 00:00:00 2001 From: vend Date: Fri, 27 Jan 2023 17:59:13 +0500 Subject: [PATCH 02/14] updated unit test for the repository utils --- .../chw/util/RepositoryUtilsTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java index 598fbb6163..77ca3c42d9 100644 --- a/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java +++ b/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java @@ -1,8 +1,11 @@ package org.smartregister.chw.util; +import net.sqlcipher.Cursor; import net.sqlcipher.MatrixCursor; import net.sqlcipher.database.SQLiteDatabase; +import org.json.JSONException; +import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -13,7 +16,15 @@ import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; import org.smartregister.chw.application.ChwApplication; +import org.smartregister.domain.Event; import org.smartregister.repository.EventClientRepository; +import org.smartregister.sync.helper.ECSyncHelper; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; @RunWith(RobolectricTestRunner.class) @Config(application = ChwApplication.class, sdk = 22) @@ -22,6 +33,13 @@ public class RepositoryUtilsTest { @Mock private SQLiteDatabase database; + @Mock + private Cursor cursor; + + @Mock + private ECSyncHelper ecSyncHelper; + + @Before public void setUp() { MockitoAnnotations.initMocks(this); @@ -131,4 +149,22 @@ private static String getSampleEventJSONString() { "}"; } + @Test + public void testReadEvents() throws JSONException { + List expectedEvents = new ArrayList<>(); + Event event1 = new Event(); + event1.setEventId("event1"); + event1.setBaseEntityId("158cb2d0-a78f-4087-9ccc-0a0de9724548"); + expectedEvents.add(event1); + when(cursor.getCount()).thenReturn(1); + when(cursor.moveToFirst()).thenReturn(true); + when(cursor.isAfterLast()).thenReturn(false, false, true); + when(cursor.getString(cursor.getColumnIndex("json"))).thenReturn(getSampleEventJSONString(), getSampleEventJSONString()); + when(ecSyncHelper.convert(new JSONObject(getSampleEventJSONString()), Event.class)).thenReturn(event1); + + List actualEvents = RepositoryUtils.readEvents(cursor); + + assertEquals(expectedEvents.get(0).getBaseEntityId(), actualEvents.get(0).getBaseEntityId()); + } + } From 073789590c80259c3a6bd4966c560efc544054d2 Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 30 Jan 2023 17:28:05 +0500 Subject: [PATCH 03/14] updated unit test for the repository utils --- .../chw/util/RepositoryUtilsTest.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java index 77ca3c42d9..2b77924a71 100644 --- a/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java +++ b/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java @@ -24,6 +24,9 @@ import java.util.List; import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @RunWith(RobolectricTestRunner.class) @@ -53,7 +56,7 @@ public void updateNullEventIdsUpdatesCorrectEvents() { ArgumentMatchers.any(String[].class), ArgumentMatchers.eq("eventId IS NULL AND validationStatus = ?"), ArgumentMatchers.any(String[].class), ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), ArgumentMatchers.isNull()); RepositoryUtils.updateNullEventIds(database); - Mockito.verify(database).execSQL("UPDATE event SET eventId = '3b598b80-13ee-4a9a-8cd1-8e66fa76bbe9', " + + verify(database).execSQL("UPDATE event SET eventId = '3b598b80-13ee-4a9a-8cd1-8e66fa76bbe9', " + "syncStatus = 'Synced' WHERE formSubmissionId = '45a294f5-ec2f-4233-847a-6f7910a6e63f';"); } @@ -167,4 +170,16 @@ public void testReadEvents() throws JSONException { assertEquals(expectedEvents.get(0).getBaseEntityId(), actualEvents.get(0).getBaseEntityId()); } + + @Test + public void addDetailsColumnToFamilySearchTable_ShouldAddColumnsSuccessfully() { + // When + RepositoryUtils.addDetailsColumnToFamilySearchTable(database); + + // Then + verify(database, times(1)).execSQL("ALTER TABLE ec_family ADD COLUMN entity_type VARCHAR; " + + "UPDATE ec_family SET entity_type = 'ec_family' WHERE id is not null;"); + verify(database, times(5)).execSQL(anyString()); + } + } From 293b808484ce64d5600b14a001f02f2c9a31abd7 Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 30 Jan 2023 18:10:16 +0500 Subject: [PATCH 04/14] updated unit test for the repository utils --- .../org/smartregister/chw/util/RepositoryUtilsTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java index 2b77924a71..76aa75af47 100644 --- a/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java +++ b/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java @@ -182,4 +182,11 @@ public void addDetailsColumnToFamilySearchTable_ShouldAddColumnsSuccessfully() { verify(database, times(5)).execSQL(anyString()); } + @Test + public void updateClientValidationStatusTest() + { + RepositoryUtils.updateClientValidateStatus(database); + verify(database, times(1)).execSQL(anyString()); + } + } From 985705f304fbcb0323021f3cafead16939ac59e6 Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 30 Jan 2023 19:10:02 +0500 Subject: [PATCH 05/14] added unit test for ChwRepositoryFlv --- .../chw/repository/ChwRepositoryFlvTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 opensrp-chw/src/test/java/org/smartregister/chw/repository/ChwRepositoryFlvTest.java diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/repository/ChwRepositoryFlvTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/repository/ChwRepositoryFlvTest.java new file mode 100644 index 0000000000..2cac6be2dc --- /dev/null +++ b/opensrp-chw/src/test/java/org/smartregister/chw/repository/ChwRepositoryFlvTest.java @@ -0,0 +1,29 @@ +package org.smartregister.chw.repository; + +import net.sqlcipher.database.SQLiteDatabase; + +import org.junit.Test; +import org.mockito.Mockito; +import org.smartregister.immunization.repository.VaccineRepository; + +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + + +public class ChwRepositoryFlvTest { + + @Test + public void testOnUpgrade() { + SQLiteDatabase db = Mockito.mock(SQLiteDatabase.class); + ChwRepositoryFlv.onUpgrade(null, db, 1, 2); + verify(db).execSQL(VaccineRepository.UPDATE_TABLE_ADD_EVENT_ID_COL); + verify(db).execSQL(VaccineRepository.EVENT_ID_INDEX); + verify(db).execSQL(VaccineRepository.UPDATE_TABLE_ADD_FORMSUBMISSION_ID_COL); + verify(db).execSQL(VaccineRepository.FORMSUBMISSION_INDEX); + verify(db).execSQL(VaccineRepository.UPDATE_TABLE_ADD_OUT_OF_AREA_COL); + verify(db).execSQL(VaccineRepository.UPDATE_TABLE_ADD_OUT_OF_AREA_COL_INDEX); + verify(db).execSQL(VaccineRepository.UPDATE_TABLE_ADD_HIA2_STATUS_COL); + + + } +} \ No newline at end of file From 6109c03eccb8f512a2181b69fb748b94cdf9a17e Mon Sep 17 00:00:00 2001 From: vend Date: Wed, 1 Feb 2023 12:37:17 +0500 Subject: [PATCH 06/14] updated method name --- .../org/smartregister/chw/repository/ChwRepositoryFlvTest.java | 1 - .../java/org/smartregister/chw/util/RepositoryUtilsTest.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/repository/ChwRepositoryFlvTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/repository/ChwRepositoryFlvTest.java index 2cac6be2dc..57e14539b0 100644 --- a/opensrp-chw/src/test/java/org/smartregister/chw/repository/ChwRepositoryFlvTest.java +++ b/opensrp-chw/src/test/java/org/smartregister/chw/repository/ChwRepositoryFlvTest.java @@ -6,7 +6,6 @@ import org.mockito.Mockito; import org.smartregister.immunization.repository.VaccineRepository; -import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java index 76aa75af47..480fc0f7d4 100644 --- a/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java +++ b/opensrp-chw/src/test/java/org/smartregister/chw/util/RepositoryUtilsTest.java @@ -172,7 +172,7 @@ public void testReadEvents() throws JSONException { @Test - public void addDetailsColumnToFamilySearchTable_ShouldAddColumnsSuccessfully() { + public void addDetailsColumnToFamilySearchTableShouldAddColumnsSuccessfully() { // When RepositoryUtils.addDetailsColumnToFamilySearchTable(database); From ddcd1393c92e9690d077fae26164e4df54aefc0e Mon Sep 17 00:00:00 2001 From: vend Date: Wed, 1 Feb 2023 20:44:54 +0500 Subject: [PATCH 07/14] removed unused variables --- .../main/java/org/smartregister/chw/util/RepositoryUtils.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java b/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java index 81f36fa2d7..b42d1e0ed2 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java @@ -29,10 +29,6 @@ public interface RepositoryUtils { String VALIDATION_STATUS = "validationStatus"; String STATUS_INVALID = "Invalid"; - String ADD_MISSING_REPORTING_COLUMN = "ALTER TABLE 'indicator_queries' ADD COLUMN expected_indicators TEXT NULL;"; - String FAMILY_MEMBER_ADD_REASON_FOR_REGISTRATION = "ALTER TABLE 'ec_family_member' ADD COLUMN reasons_for_registration TEXT NULL;"; - String EC_REFERRAL_ADD_FP_METHOD_COLUMN = "ALTER TABLE 'ec_referral' ADD COLUMN fp_method_accepted_referral TEXT NULL;"; - String[] UPDATE_REPOSITORY_TYPES = { "UPDATE recurring_service_types SET service_group = 'woman' WHERE type = 'IPTp-SP';", "UPDATE recurring_service_types SET service_group = 'child' WHERE type != 'IPTp-SP';", From b9e6f142a5c9f984927d2fe94f50afe79967263e Mon Sep 17 00:00:00 2001 From: vend Date: Wed, 1 Feb 2023 21:14:48 +0500 Subject: [PATCH 08/14] restored the variables --- .../main/java/org/smartregister/chw/util/RepositoryUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java b/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java index b42d1e0ed2..81f36fa2d7 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/util/RepositoryUtils.java @@ -29,6 +29,10 @@ public interface RepositoryUtils { String VALIDATION_STATUS = "validationStatus"; String STATUS_INVALID = "Invalid"; + String ADD_MISSING_REPORTING_COLUMN = "ALTER TABLE 'indicator_queries' ADD COLUMN expected_indicators TEXT NULL;"; + String FAMILY_MEMBER_ADD_REASON_FOR_REGISTRATION = "ALTER TABLE 'ec_family_member' ADD COLUMN reasons_for_registration TEXT NULL;"; + String EC_REFERRAL_ADD_FP_METHOD_COLUMN = "ALTER TABLE 'ec_referral' ADD COLUMN fp_method_accepted_referral TEXT NULL;"; + String[] UPDATE_REPOSITORY_TYPES = { "UPDATE recurring_service_types SET service_group = 'woman' WHERE type = 'IPTp-SP';", "UPDATE recurring_service_types SET service_group = 'child' WHERE type != 'IPTp-SP';", From b6b64c045832d0014c294f1da3a66bb3db1327bf Mon Sep 17 00:00:00 2001 From: vend Date: Thu, 2 Feb 2023 11:14:54 +0500 Subject: [PATCH 09/14] added test for the All client utils --- .../chw/util/AllClientUtilsTest.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 opensrp-chw/src/test/java/org/smartregister/chw/util/AllClientUtilsTest.java diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/util/AllClientUtilsTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/util/AllClientUtilsTest.java new file mode 100644 index 0000000000..2fa5e9f883 --- /dev/null +++ b/opensrp-chw/src/test/java/org/smartregister/chw/util/AllClientUtilsTest.java @@ -0,0 +1,48 @@ +package org.smartregister.chw.util; + +import android.app.Activity; +import android.os.Bundle; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentMatchers; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.smartregister.chw.anc.util.DBConstants; +import org.smartregister.commonregistry.CommonPersonObjectClient; + +import java.util.Map; + +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class AllClientUtilsTest { + + @Mock + private Activity mockActivity; + + @Mock + private CommonPersonObjectClient mockPatient; + + @Mock + private Bundle mockBundle; + + @Mock + private Map map; + + + @Before + public void setup (){ + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGoToChildProfileAboveFiveYears() { + String dobString = "15"; + when(mockPatient.getColumnmaps()).thenReturn(map); + when(map.get(DBConstants.KEY.DOB)).thenReturn(dobString); + AllClientsUtils.goToChildProfile(mockActivity, mockPatient, mockBundle); + verify(mockActivity).startActivity(ArgumentMatchers.any()); + + } +} From 61efb28c162436ca93ace8f1f34974997cfb6ead Mon Sep 17 00:00:00 2001 From: vend Date: Thu, 2 Feb 2023 14:32:02 +0500 Subject: [PATCH 10/14] chaged the ba Unique ID source to 1 --- opensrp-chw/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-chw/build.gradle b/opensrp-chw/build.gradle index 8d12b71548..56286c062a 100644 --- a/opensrp-chw/build.gradle +++ b/opensrp-chw/build.gradle @@ -234,7 +234,7 @@ android { versionName "1.0.8" buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10000' - buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '1' + buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' buildConfigField "String", 'opensrp_url', '"https://boresha-afya.smartregister.org/opensrp/"' buildConfigField "String", 'guidebooks_url', '"https://opensrp.s3.amazonaws.com/media/ba/"' buildConfigField "String", 'opensrp_url_debug', '"https://boresha-afya-stage.smartregister.org/opensrp/"' From ca0aaa2c1166437804663069f4360aefcc4e74e5 Mon Sep 17 00:00:00 2001 From: vend Date: Fri, 3 Feb 2023 11:10:37 +0500 Subject: [PATCH 11/14] added the migration for all clients --- .../smartregister/chw/repository/ChwRepositoryFlv.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index 52f8af9c2a..79575adb00 100644 --- a/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -48,14 +48,12 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 12: upgradeToVersion12(db); break; - case 13: - upgradeToVersion13(db); - break; default: break; } upgradeTo++; } + RepositoryUtils.updateClientValidateStatus(db); } private static void upgradeToVersion2(Context context, SQLiteDatabase db) { @@ -168,8 +166,4 @@ private static void upgradeToVersion11(SQLiteDatabase db) { private static void upgradeToVersion12(SQLiteDatabase db) { RepositoryUtils.updateNullEventIds(db); } - private static void upgradeToVersion13 (SQLiteDatabase db) - { - RepositoryUtils.updateClientValidateStatus(db); - } } From d81b0a782d472042b3738912910edce160136a1d Mon Sep 17 00:00:00 2001 From: vend Date: Fri, 3 Feb 2023 14:36:23 +0500 Subject: [PATCH 12/14] added the migration for all clients ba, chad,drc,guinea,liberia,lmh,togo --- opensrp-chw/build.gradle | 40 +++++++++---------- .../chw/repository/ChwRepositoryFlv.java | 7 ++++ .../chw/repository/ChwRepositoryFlv.java | 7 ++++ .../chw/repository/ChwRepositoryFlv.java | 7 ++++ .../chw/repository/ChwRepositoryFlv.java | 7 ++++ .../chw/repository/ChwRepositoryFlv.java | 8 +++- .../chw/repository/ChwRepositoryFlv.java | 6 +++ .../chw/repository/ChwRepositoryFlv.java | 7 ++++ 8 files changed, 68 insertions(+), 21 deletions(-) diff --git a/opensrp-chw/build.gradle b/opensrp-chw/build.gradle index 56286c062a..559889c76f 100644 --- a/opensrp-chw/build.gradle +++ b/opensrp-chw/build.gradle @@ -230,8 +230,8 @@ android { ba { dimension = 'baseDimension' applicationIdSuffix ".ba" - versionCode 8 - versionName "1.0.8" + versionCode 9 + versionName "1.0.9" buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' @@ -244,13 +244,13 @@ android { buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS_DEBUG", '{"Ward", "MOH Jhpiego Facility Name", "Health Facility", "Village", "Village Sublocations"}' buildConfigField "String", 'DEFAULT_LOCATION', '"Village Sublocations"' buildConfigField "String", 'DEFAULT_LOCATION_DEBUG', '"Village"' - buildConfigField "int", "DATABASE_VERSION", '23' + buildConfigField "int", "DATABASE_VERSION", '24' } chad { dimension = 'baseDimension' applicationIdSuffix ".chad" - versionCode 3 - versionName "1.0.3" + versionCode 4 + versionName "1.0.4" buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' @@ -262,7 +262,7 @@ android { buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS_DEBUG", '{"Clinic" , "CHSS" , "CHA"}' buildConfigField "String", 'DEFAULT_LOCATION', '"Village"' buildConfigField "String", 'DEFAULT_LOCATION_DEBUG', '"CHA"' - buildConfigField "int", "DATABASE_VERSION", '15' + buildConfigField "int", "DATABASE_VERSION", '16' buildConfigField "int", "MAX_CONNECTION_TIMEOUT", '5' buildConfigField "int", "MAX_READ_TIMEOUT", '5' } @@ -270,8 +270,8 @@ android { resConfigs "en", "fr" dimension = 'baseDimension' applicationIdSuffix ".drc" - versionCode 11 - versionName "1.0.16" + versionCode 12 + versionName "1.0.17" buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' @@ -291,8 +291,8 @@ android { guinea { dimension = 'baseDimension' applicationIdSuffix ".guinea" - versionCode 4 - versionName "1.0.3" + versionCode 5 + versionName "1.0.4" buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '1000' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '500' @@ -307,13 +307,13 @@ android { buildConfigField "String", 'DEFAULT_LOCATION_PREVIEW', '"Village"' buildConfigField "String", 'DEFAULT_LOCATION_DEBUG', '"CHW"' buildConfigField "String", 'DEFAULT_LOCATION', '"Village"' - buildConfigField "int", "DATABASE_VERSION", '8' + buildConfigField "int", "DATABASE_VERSION", '9' } togo { dimension = 'baseDimension' applicationIdSuffix ".togo" - versionCode 26 - versionName "1.2.7" + versionCode 27 + versionName "1.2.8" buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '1000' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '500' @@ -327,12 +327,12 @@ android { buildConfigField "String", 'DEFAULT_LOCATION', '"Village"' buildConfigField "int", "MAX_CONNECTION_TIMEOUT", '10' buildConfigField "int", "MAX_READ_TIMEOUT", '10' - buildConfigField "int", "DATABASE_VERSION", '21' + buildConfigField "int", "DATABASE_VERSION", '22' } liberia { dimension = 'baseDimension' - versionCode 8 - versionName "1.0.1" + versionCode 9 + versionName "1.0.2" buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' @@ -346,13 +346,13 @@ android { buildConfigField "String", 'DEFAULT_LOCATION_DEBUG', '"CHA"' buildConfigField "int", "MAX_CONNECTION_TIMEOUT", '5' buildConfigField "int", "MAX_READ_TIMEOUT", '5' - buildConfigField "int", "DATABASE_VERSION", '8' + buildConfigField "int", "DATABASE_VERSION", '9' } lmh { dimension = 'baseDimension' applicationIdSuffix ".lmh" - versionCode 7 - versionName "2.0.3" + versionCode 8 + versionName "2.0.4" buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10000' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '1' @@ -364,7 +364,7 @@ android { buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS_DEBUG", '{"Country" , "County" , "District", "Clinics", "CHSS", "Village","Commune"}' buildConfigField "String", 'DEFAULT_LOCATION', '"Commune"' buildConfigField "String", 'DEFAULT_LOCATION_DEBUG', '"Commune"' - buildConfigField "int", "DATABASE_VERSION", '7' + buildConfigField "int", "DATABASE_VERSION", '8' } } diff --git a/opensrp-chw/src/ba/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/ba/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index 0a4ab3f3e5..a585ea5f07 100644 --- a/opensrp-chw/src/ba/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/ba/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -102,6 +102,9 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 23: upgradeToVersion23(context, db); break; + case 24: + upgradeToVersion24(db); + break; default: break; } @@ -371,4 +374,8 @@ private static void upgradeToVersion23(Context context, SQLiteDatabase db) { } } + private static void upgradeToVersion24(SQLiteDatabase db) { + RepositoryUtils.updateClientValidateStatus(db); + } + } diff --git a/opensrp-chw/src/chad/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/chad/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index f50fdad831..97bc688f77 100644 --- a/opensrp-chw/src/chad/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/chad/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -70,6 +70,9 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 15: upgradeToVersion15(db); break; + case 16: + upgradeToVersion16(db); + break; default: break; } @@ -223,4 +226,8 @@ private static void initializeIndicatorDefinitions(ReportingLibrary reportingLib reportingLibrary.readConfigFile(configFile, sqLiteDatabase); } } + + private static void upgradeToVersion16(SQLiteDatabase db) { + RepositoryUtils.updateClientValidateStatus(db); + } } diff --git a/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index 79575adb00..616274af23 100644 --- a/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/drc/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -48,6 +48,9 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 12: upgradeToVersion12(db); break; + case 13: + upgradeToVersion13(db); + break; default: break; } @@ -166,4 +169,8 @@ private static void upgradeToVersion11(SQLiteDatabase db) { private static void upgradeToVersion12(SQLiteDatabase db) { RepositoryUtils.updateNullEventIds(db); } + + private static void upgradeToVersion13(SQLiteDatabase db) { + RepositoryUtils.updateClientValidateStatus(db); + } } diff --git a/opensrp-chw/src/guinea/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/guinea/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index 81e8ad5229..a832636b75 100644 --- a/opensrp-chw/src/guinea/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/guinea/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -50,6 +50,9 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 8: upgradeToVersion8(db); break; + case 9: + upgradeToVersion9(db); + break; default: break; } @@ -158,5 +161,9 @@ private static void upgradeToVersion7(SQLiteDatabase db) { } } + private static void upgradeToVersion9(SQLiteDatabase db) { + RepositoryUtils.updateClientValidateStatus(db); + } + } diff --git a/opensrp-chw/src/liberia/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/liberia/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index d0b52a8cc2..b24863ccca 100644 --- a/opensrp-chw/src/liberia/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/liberia/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -49,6 +49,8 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 8: upgradeToVersion8(db); break; + case 9: + upgradeToVersion9(db); default: break; } @@ -152,6 +154,10 @@ private static void upgradeToVersion7(SQLiteDatabase db) { } private static void upgradeToVersion8(SQLiteDatabase db) { - RepositoryUtils.updateNullEventIds(db); + RepositoryUtils.updateNullEventIds(db); + } + + private static void upgradeToVersion9(SQLiteDatabase db) { + RepositoryUtils.updateClientValidateStatus(db); } } \ No newline at end of file diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index 23a4e227ab..c8bbfb6a73 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -47,6 +47,8 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 7: upgradeToVersion7(db); break; + case 8: + upgradeToVersion8(db); default: break; } @@ -146,4 +148,8 @@ private static void upgradeToVersion7(SQLiteDatabase db) { Timber.e(e, "upgradeToVersion7"); } } + + private static void upgradeToVersion8(SQLiteDatabase db) { + RepositoryUtils.updateClientValidateStatus(db); + } } \ No newline at end of file diff --git a/opensrp-chw/src/togo/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/togo/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index e7fbba4475..30068cba73 100644 --- a/opensrp-chw/src/togo/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/togo/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -109,6 +109,9 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, case 21: upgradeToVersion21(db); break; + case 22: + upgradeToVersion21(db); + break; default: break; } @@ -424,4 +427,8 @@ private static void upgradeToVersion20(SQLiteDatabase db) { private static void upgradeToVersion21(SQLiteDatabase db) { RepositoryUtils.updateNullEventIds(db); } + + private static void upgradeToVersion22(SQLiteDatabase db) { + RepositoryUtils.updateClientValidateStatus(db); + } } From fd56abcaf9e54338391f5a420b4ea02182fcdcd9 Mon Sep 17 00:00:00 2001 From: vend Date: Fri, 3 Feb 2023 19:14:05 +0500 Subject: [PATCH 13/14] added the migration for all clients ba, chad,drc,guinea,liberia,lmh,togo --- .../java/org/smartregister/chw/repository/ChwRepositoryFlv.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-chw/src/togo/java/org/smartregister/chw/repository/ChwRepositoryFlv.java b/opensrp-chw/src/togo/java/org/smartregister/chw/repository/ChwRepositoryFlv.java index 30068cba73..1bc1128373 100644 --- a/opensrp-chw/src/togo/java/org/smartregister/chw/repository/ChwRepositoryFlv.java +++ b/opensrp-chw/src/togo/java/org/smartregister/chw/repository/ChwRepositoryFlv.java @@ -110,7 +110,7 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, upgradeToVersion21(db); break; case 22: - upgradeToVersion21(db); + upgradeToVersion22(db); break; default: break; From e093fa00c12a15f66e76045abada28b8e6140499 Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 6 Feb 2023 06:05:57 +0500 Subject: [PATCH 14/14] added the migration for all clients ba, chad,drc,guinea,liberia,lmh,togo changed the target sdk to 31 --- build.gradle | 2 +- opensrp-chw/src/main/AndroidManifest.xml | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 359b3f9b6b..1674515b14 100644 --- a/build.gradle +++ b/build.gradle @@ -74,7 +74,7 @@ subprojects { ext.androidBuildToolsVersion = '29.0.3' ext.androidMinSdkVersion = 19 ext.androidCompileSdkVersion = 29 - ext.androidTargetSdkVersion = 29 + ext.androidTargetSdkVersion = 31 ext.androidAnnotationsVersion = '3.0.1' ext.androidAnnotationsAPIVersion = '3.0.1' diff --git a/opensrp-chw/src/main/AndroidManifest.xml b/opensrp-chw/src/main/AndroidManifest.xml index 52dfd8d690..2fbaf7d4c9 100644 --- a/opensrp-chw/src/main/AndroidManifest.xml +++ b/opensrp-chw/src/main/AndroidManifest.xml @@ -127,7 +127,8 @@ android:name=".activity.ChildProfileActivity" android:launchMode="singleTop" android:label="@string/child_details" - android:theme="@style/ChwTheme.NoActionBar"> + android:theme="@style/ChwTheme.NoActionBar" + android:exported="true"> @@ -170,6 +171,7 @@ android:roundIcon="@drawable/ic_launcher_round" android:screenOrientation="portrait" android:theme="@style/ChwTheme.Login" + android:exported="true" android:windowSoftInputMode="stateAlwaysHidden|adjustResize"> @@ -301,6 +303,15 @@ + + + + + + + +