From fd21317f6cc8e05390e8d5f8bcb0fdd2446fa3ee Mon Sep 17 00:00:00 2001 From: bennsimon Date: Tue, 4 Feb 2020 18:05:45 +0300 Subject: [PATCH 1/2] updated child table make child table configurable --- .../growthmonitoring/GrowthMonitoringConfig.java | 15 +++++++++++++++ .../intent/ZScoreRefreshIntentService.java | 9 ++++----- .../util/GrowthMonitoringConstants.java | 3 +-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/GrowthMonitoringConfig.java b/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/GrowthMonitoringConfig.java index b2d6dd2..80aaad2 100644 --- a/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/GrowthMonitoringConfig.java +++ b/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/GrowthMonitoringConfig.java @@ -1,5 +1,7 @@ package org.smartregister.growthmonitoring; +import org.smartregister.growthmonitoring.util.GrowthMonitoringConstants; + /** * Created by ndegwamartin on 2019-05-28. */ @@ -10,6 +12,11 @@ public class GrowthMonitoringConfig { private String femaleWeightZScoreFile; private String femaleHeightZScoreFile; private String genderNeutralZScoreFile; + private String childTable; + + public GrowthMonitoringConfig() { + setChildTable(GrowthMonitoringConstants.CHILD_TABLE_NAME); + } public String getMaleWeightZScoreFile() { if (maleWeightZScoreFile != null) { @@ -66,4 +73,12 @@ public String getGenderNeutralZScoreFile() { public void setGenderNeutralZScoreFile(String genderNeutralZScoreFile) { this.genderNeutralZScoreFile = genderNeutralZScoreFile; } + + public String getChildTable() { + return childTable; + } + + public void setChildTable(String childTable) { + this.childTable = childTable; + } } diff --git a/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/service/intent/ZScoreRefreshIntentService.java b/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/service/intent/ZScoreRefreshIntentService.java index 2e63281..cd8fe31 100644 --- a/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/service/intent/ZScoreRefreshIntentService.java +++ b/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/service/intent/ZScoreRefreshIntentService.java @@ -154,7 +154,7 @@ private void dumpWeightCsv(Gender gender, boolean force) { } } } catch (Exception e) { - Timber.e(e,"ZScoreRefreshIntentService --> dumpWeightCsv"); + Timber.e(e, "ZScoreRefreshIntentService --> dumpWeightCsv"); } } @@ -214,7 +214,7 @@ private void dumpHeightCsv(Gender gender, boolean force) { } } } catch (Exception e) { - Timber.e(e,"ZScoreRefreshIntentService --> dumpHeightCsv"); + Timber.e(e, "ZScoreRefreshIntentService --> dumpHeightCsv"); } } @@ -265,7 +265,7 @@ private void calculateChildWeightZScores() { } } } catch (Exception e) { - Timber.e(e,"ZScoreRefreshIntentService --> calculateChildWeightZScores"); + Timber.e(e, "ZScoreRefreshIntentService --> calculateChildWeightZScores"); } } @@ -321,7 +321,7 @@ private void calculateChildHeightZScores() { private CommonPersonObjectClient getChildDetails(String baseEntityId) { CommonPersonObject rawDetails = - GrowthMonitoringLibrary.getInstance().context().commonrepository(GrowthMonitoringConstants.CHILD_TABLE_NAME) + GrowthMonitoringLibrary.getInstance().context().commonrepository(GrowthMonitoringLibrary.getInstance().getConfig().getChildTable()) .findByBaseEntityId(baseEntityId); if (rawDetails != null) { // Get extra child details @@ -397,7 +397,6 @@ private void processResponse(URLConnection urlConnection, Gender gender) { /** * @param connection object; note: before calling this function, ensure that the connection is already be open, and any * writes to the connection's output stream should have already been completed. - * * @return String containing the body of the connection response or null if the input stream could not be read correctly */ private String readInputStreamToString(URLConnection connection) { diff --git a/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/util/GrowthMonitoringConstants.java b/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/util/GrowthMonitoringConstants.java index 11d33fc..9b98135 100644 --- a/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/util/GrowthMonitoringConstants.java +++ b/opensrp-growth-monitoring/src/main/java/org/smartregister/growthmonitoring/util/GrowthMonitoringConstants.java @@ -10,8 +10,7 @@ public class GrowthMonitoringConstants { public static final String ZSCORE_MALE_URL = "http://www.who.int/childgrowth/standards/wfa_boys_0_5_zscores.txt"; public static final String ZSCORE_FEMALE_URL = "http://www.who.int/childgrowth/standards/wfa_girls_0_5_zscores.txt"; - public static final String CHILD_TABLE_NAME = "ec_child"; - public static final String MOTHER_TABLE_NAME = "ec_mother"; + public static final String CHILD_TABLE_NAME = "ec_client"; public static final int GROWTH_MONITORING_SYNC_TIME = BuildConfig.GROWTH_MONITORING_SYNC_TIME; public static final String FIRST_NAME = "first_name"; From 8427cba311f6b90aeb7f9aa6b51f547eb598e50d Mon Sep 17 00:00:00 2001 From: bennsimon Date: Wed, 5 Feb 2020 10:59:55 +0300 Subject: [PATCH 2/2] update lib snapshot --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9c9a1c8..a5236ec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1.1.15-SNAPSHOT +VERSION_NAME=1.1.16-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Growth Monitoring Application