From 11ca866a7da5c836c3de44d5c7338a5aa887426e Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 4 Oct 2021 12:18:04 +0500 Subject: [PATCH 1/6] updated query for fetching events added event createdAt date if the eventdate is null --- .../reporting/dao/ReportIndicatorDaoImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/dao/ReportIndicatorDaoImpl.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/dao/ReportIndicatorDaoImpl.java index ec7694da..2217d76c 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/dao/ReportIndicatorDaoImpl.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/dao/ReportIndicatorDaoImpl.java @@ -49,7 +49,7 @@ public class ReportIndicatorDaoImpl implements ReportIndicatorDao { public static final String REPORT_LAST_PROCESSED_DATE = "REPORT_LAST_PROCESSED_DATE"; public static String DAILY_TALLY_DATE_FORMAT = "yyyy-MM-dd"; - public static String PREVIOUS_REPORT_DATES_QUERY = "select distinct eventDate, " + EventClientRepository.event_column.updatedAt + " from " + public static String PREVIOUS_REPORT_DATES_QUERY = "select distinct eventDate, " + EventClientRepository.event_column.updatedAt +", "+ EventClientRepository.event_column.dateCreated + " from " + EventClientRepository.Table.event.name(); private static String eventDateFormat = "yyyy-MM-dd HH:mm:ss"; @@ -185,7 +185,12 @@ protected LinkedHashMap getReportEventDates(@NonNull Date timeNow, Date eventDate; Date updateDate; for (HashMap val : values) { - eventDate = formatDate(val.get(EventClientRepository.event_column.eventDate.name()), eventDateFormat); + String eventDateString = val.get(EventClientRepository.event_column.eventDate.name()); + if(eventDateString == null) + eventDateString = val.get(EventClientRepository.event_column.dateCreated.name()); + + + eventDate = formatDate(eventDateString, eventDateFormat); updateDate = formatDate(val.get(EventClientRepository.event_column.updatedAt.name()), eventDateFormat); String keyDate = new SimpleDateFormat(DAILY_TALLY_DATE_FORMAT, Locale.getDefault()).format(eventDate); From 3f631f0a75e92c567e41c33f5323bfc78df22b58 Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 4 Oct 2021 14:32:48 +0500 Subject: [PATCH 2/6] snapshot version updated --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 21337085..2d326886 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=0.1.1-SNAPSHOT +VERSION_NAME=0.0.23-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Reporting Library From 54e512b2d32e3c691fa45643809b87d363900a53 Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 4 Oct 2021 15:15:28 +0500 Subject: [PATCH 3/6] client core version updated fhir-model version updated --- opensrp-reporting/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opensrp-reporting/build.gradle b/opensrp-reporting/build.gradle index 83cc1e13..101f9143 100644 --- a/opensrp-reporting/build.gradle +++ b/opensrp-reporting/build.gradle @@ -95,7 +95,7 @@ artifacts { } dependencies { - implementation('org.smartregister:opensrp-client-core:1.15.4-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-core:4.3.19-SNAPSHOT@aar') { transitive = true exclude group: 'com.github.bmelnychuk', module: 'atv' exclude group: 'com.google.guava', module: 'guava' @@ -106,7 +106,7 @@ dependencies { exclude group: 'com.ibm.fhir', module: 'fhir-model' } - compileOnly 'com.ibm.fhir:fhir-model:4.2.3' + compileOnly 'com.ibm.fhir:fhir-model:4.7.1' implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' From 3ed9b66e59fca008cc031793081174902707e0c1 Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 4 Oct 2021 16:41:21 +0500 Subject: [PATCH 4/6] removed unnecessary stubbings which were causing the test to fail --- .../reporting/dao/ReportIndicatorDaoImplTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java b/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java index 9548bb3e..053a51b2 100644 --- a/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java +++ b/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java @@ -116,8 +116,8 @@ public void testGenerateDailyIndicatorTalliesCallsSaveTalliesEqualToNumberOfRepo Mockito.when(coreLibrary.context()).thenReturn(context); Mockito.when(context.getAppProperties()).thenReturn(appProperties); - Mockito.when(appProperties.hasProperty(Constants.ReportingConfig.SHOULD_ALLOW_ZERO_TALLIES)).thenReturn(true); - Mockito.when(appProperties.getPropertyBoolean(Constants.ReportingConfig.SHOULD_ALLOW_ZERO_TALLIES)).thenReturn(true); +// Mockito.when(appProperties.hasProperty(Constants.ReportingConfig.SHOULD_ALLOW_ZERO_TALLIES)).thenReturn(true); +// Mockito.when(appProperties.getPropertyBoolean(Constants.ReportingConfig.SHOULD_ALLOW_ZERO_TALLIES)).thenReturn(true); ReportingLibrary reportingLibrarySpy = Mockito.mock(ReportingLibrary.class); ReflectionHelpers.setStaticField(ReportingLibrary.class, "instance", reportingLibrarySpy); @@ -161,8 +161,8 @@ public void saveTalliesGeneratesTallyObject() { Mockito.when(coreLibrary.context()).thenReturn(context); Mockito.when(context.getAppProperties()).thenReturn(appProperties); - Mockito.when(appProperties.hasProperty(Constants.ReportingConfig.SHOULD_ALLOW_ZERO_TALLIES)).thenReturn(true); - Mockito.when(appProperties.getPropertyBoolean(Constants.ReportingConfig.SHOULD_ALLOW_ZERO_TALLIES)).thenReturn(true); +// Mockito.when(appProperties.hasProperty(Constants.ReportingConfig.SHOULD_ALLOW_ZERO_TALLIES)).thenReturn(true); +// Mockito.when(appProperties.getPropertyBoolean(Constants.ReportingConfig.SHOULD_ALLOW_ZERO_TALLIES)).thenReturn(true); SQLiteDatabase database = Mockito.mock(SQLiteDatabase.class); Map indicatorQueries = new HashMap<>(); From a430c4c7175acf46aef0a460f5ac3cefaef8b572 Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 4 Oct 2021 16:52:43 +0500 Subject: [PATCH 5/6] test coverage increased --- .../smartregister/reporting/dao/ReportIndicatorDaoImplTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java b/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java index 053a51b2..c8ac94ed 100644 --- a/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java +++ b/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java @@ -91,6 +91,7 @@ public void executeQueryAndReturnCountShouldReturnCountFromQuery() { Assert.assertEquals(67F, actualResult, 0); } + @Test public void getReportEventDatesShouldReturnCurrentDateWhenNoDatesRetrievedFromEventTable() { Date timeNow = Calendar.getInstance().getTime(); SQLiteDatabase database = Mockito.mock(SQLiteDatabase.class); From 04a411d2fcfa5021a27ecdb3b362f51c8d6889ac Mon Sep 17 00:00:00 2001 From: vend Date: Mon, 18 Oct 2021 19:19:56 +0500 Subject: [PATCH 6/6] version code increased to 0.1.3 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c023046f..d272829a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=0.1.2-SNAPSHOT +VERSION_NAME=0.1.3-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Reporting Library