Skip to content

Commit

Permalink
Merge pull request #59 from OpenSRP/make-child-table-configurable
Browse files Browse the repository at this point in the history
updated child table
  • Loading branch information
bennsimon authored Feb 5, 2020
2 parents 44b288b + 8427cba commit d3a1e38
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.smartregister.growthmonitoring;

import org.smartregister.growthmonitoring.util.GrowthMonitoringConstants;

/**
* Created by ndegwamartin on 2019-05-28.
*/
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void dumpWeightCsv(Gender gender, boolean force) {
}
}
} catch (Exception e) {
Timber.e(e,"ZScoreRefreshIntentService --> dumpWeightCsv");
Timber.e(e, "ZScoreRefreshIntentService --> dumpWeightCsv");
}
}

Expand Down Expand Up @@ -214,7 +214,7 @@ private void dumpHeightCsv(Gender gender, boolean force) {
}
}
} catch (Exception e) {
Timber.e(e,"ZScoreRefreshIntentService --> dumpHeightCsv");
Timber.e(e, "ZScoreRefreshIntentService --> dumpHeightCsv");

}
}
Expand Down Expand Up @@ -265,7 +265,7 @@ private void calculateChildWeightZScores() {
}
}
} catch (Exception e) {
Timber.e(e,"ZScoreRefreshIntentService --> calculateChildWeightZScores");
Timber.e(e, "ZScoreRefreshIntentService --> calculateChildWeightZScores");
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit d3a1e38

Please sign in to comment.