-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize native forms v2 #522
base: develop
Are you sure you want to change the base?
Conversation
add contact no to globals when quick check is opened from register
fix required field counts
@@ -130,6 +133,25 @@ protected void onResumption() { | |||
} | |||
} | |||
|
|||
private void populatePreviousContactMissingEssentials(HashMap<String, String> clientDetails) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method populatePreviousContactMissingEssentials
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
} | ||
} | ||
|
||
private static void updateLocationTree(@NonNull JSONArray fields, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method updateLocationTree
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
@@ -187,6 +241,28 @@ public static JSONObject getFieldJSONObject(JSONArray jsonArray, String key) { | |||
} | |||
} | |||
|
|||
protected static void processLocationFields(@NonNull JSONArray fields) throws JSONException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method processLocationFields
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
@@ -222,31 +302,60 @@ private static void getDobStrings(JSONArray fields) throws JSONException { | |||
} | |||
} | |||
|
|||
private static void initializeFirstContactValues(JSONArray fields) throws JSONException { | |||
private static String initializeFirstContactValues(JSONArray fields) throws JSONException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method initializeFirstContactValues
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
@@ -222,31 +302,60 @@ private static void getDobStrings(JSONArray fields) throws JSONException { | |||
} | |||
} | |||
|
|||
private static void initializeFirstContactValues(JSONArray fields) throws JSONException { | |||
private static String initializeFirstContactValues(JSONArray fields) throws JSONException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method initializeFirstContactValues
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
return getProperties(AncLibrary.getInstance().getApplicationContext()).getProperty(ConstantsUtils.Properties.DUE_CHECK_STRATEGY, ""); | ||
} | ||
|
||
public static HashMap<String, HashMap<String, String>> buildRepeatingGroupValues(@NonNull JSONArray fields, String fieldName) throws JSONException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method buildRepeatingGroupValues
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
return getProperties(AncLibrary.getInstance().getApplicationContext()).getProperty(ConstantsUtils.Properties.DUE_CHECK_STRATEGY, ""); | ||
} | ||
|
||
public static HashMap<String, HashMap<String, String>> buildRepeatingGroupValues(@NonNull JSONArray fields, String fieldName) throws JSONException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method buildRepeatingGroupValues
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
|
||
} | ||
|
||
public static void createPreviousVisitFromGroup(@NonNull String strGroup, @NonNull String baseEntityId) throws JSONException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method createPreviousVisitFromGroup
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Code Climate has analyzed commit dd5c4c3 and detected 16 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
@bennsimon is this ready for review? |
gradle.properties
Outdated
android.debug.obsoleteApi=true | ||
|
||
## PUBLISHING VARS | ||
VERSION_NAME=2.0.1-SNAPSHOT | ||
VERSION_NAME=2.0.3.13-LOCAL-SNAPSHOT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this version name
opensrp-anc/build.gradle
Outdated
@@ -143,7 +143,7 @@ dependencies { | |||
|
|||
implementation fileTree(dir: 'libs', include: ['*.jar']) | |||
implementation 'com.android.support:appcompat-v7:28.0.0' | |||
implementation('org.smartregister:opensrp-client-native-form:1.7.28-SNAPSHOT@aar') { | |||
implementation('org.smartregister:opensrp-client-native-form:1.9.2-r117-OPTIMIZED-LOCAL-SNAPSHOT@aar') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to the correct version name
@@ -90,6 +93,12 @@ private void initializeMainContactContainers() { | |||
process(contactForms); | |||
requiredFieldsMap.put(ConstantsUtils.JsonFormUtils.ANC_TEST_TASKS_ENCOUNTER_TYPE, 0); | |||
|
|||
if (StringUtils.isNotBlank(formInvalidFields) && contactNo > 1 && !PatientRepository.isFirstVisit(baseEntityId)) { | |||
String[] pair = formInvalidFields.split(":"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check the size of this string array. Otherwise, you will get an out of bounds exception
@@ -318,7 +328,7 @@ private void processRequiredStepsField(JSONObject object) throws Exception { | |||
Iterator<String> keys = object.keys(); | |||
while (keys.hasNext()) { | |||
String key = keys.next(); | |||
if (key.startsWith(RuleConstant.STEP)) { | |||
if (key.startsWith(RuleConstant.STEP) && !object.getJSONObject(key).has("skipped")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the skipped
string to constants
@Override | ||
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
if (resultCode == RESULT_OK && data != null) { | ||
formInvalidFields = data.getStringExtra("formInvalidFields"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this string to constants
reference-app/build.gradle
Outdated
@@ -130,7 +130,7 @@ android { | |||
} | |||
|
|||
debug { | |||
resValue "string", 'opensrp_url', '"https://anc-stage.smartregister.org/opensrp/"' | |||
resValue "string", 'opensrp_url', '"https://opensrp-jembi-eregister.smartregister.org/opensrp/"' //TODO should be changed to anc staging url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this to use the ANC reference app URL
reference-app/build.gradle
Outdated
// implementation('org.smartregister:opensrp-client-native-form:1.7.30-OPTIMIZE_FORMS-SNAPSHOT@aar') { | ||
// transitive = true | ||
// exclude group: 'com.android.support', module: 'recyclerview-v7' | ||
// exclude group: 'com.android.support', module: 'appcompat-v7' | ||
// exclude group: 'com.android.support', module: 'cardview-v7' | ||
// exclude group: 'com.android.support', module: 'support-media-compat' | ||
// exclude group: 'com.android.support', module: 'support-v4' | ||
// exclude group: 'com.android.support', module: 'design' | ||
// exclude group: 'org.yaml', module: 'snakeyaml' | ||
// exclude group: 'io.ona.rdt-capture', module: 'lib' | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you disabled this?
add check got contact summar model to avoid duplicates
Here is an overview of what got changed by this pull request: Complexity increasing per file
==============================
- opensrp-anc/src/main/java/org/smartregister/anc/library/model/ContactSummaryModel.java 1
- opensrp-anc/src/main/java/org/smartregister/anc/library/activity/MainContactActivity.java 1
- opensrp-anc/src/test/java/org/smartregister/anc/library/activity/BaseActivityUnitTest.java 1
- opensrp-anc/src/main/java/org/smartregister/anc/library/task/LoadContactSummaryDataTask.java 5
- opensrp-anc/src/main/java/org/smartregister/anc/library/fragment/ProfileContactsFragment.java 1
- opensrp-anc/src/main/java/org/smartregister/anc/library/activity/ContactSummarySendActivity.java 3
- opensrp-anc/src/main/java/org/smartregister/anc/library/presenter/ContactSummaryPresenter.java 2
See the complete overview on Codacy |
Migrate to oauth2
- Update dependencies to com.github.lecho:hellocharts-android:1.5.8 and id.zelory:compressor:2.1.1 - Update 2.0.3.40-LOCAL-SNAPSHOT
#511
Make number of contact schedules shown on summary configurable
Add
contact_no
to globals for quick check, when its opened from register ActivityFix null GA
Fix incorrect count of profile contact container relevant required fields
Optimized native forms
Support use of boolean
is_first_contact
as due check strategyMake
ProfileActivity.class
configurable