Skip to content

Commit

Permalink
Merge pull request #1599 from OpenSRP/issue1596-dietary-task-history-…
Browse files Browse the repository at this point in the history
…page

Overridden getDieataryFormatter method for DRC flavour
  • Loading branch information
qaziabubakar-vd authored Dec 3, 2020
2 parents f41c6cf + 6ada942 commit 1451bd4
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 27 deletions.
2 changes: 1 addition & 1 deletion opensrp-chw/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ android {
}

dependencies {
implementation('org.smartregister:opensrp-client-chw-core:2.0.2-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-chw-core:2.0.5-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'androidx.legacy', module: 'legacy-support-v4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,35 +64,35 @@
"text": "0 - Aucun des 4 produits",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chk_no_animal_products"
"openmrs_entity_id": "chk_none_of_four_products"
},
{
"key": "chw_only_one_of_four_products",
"text": "1 - Un seul type d'aliment",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chw_one_animal_product_or_fruit"
"openmrs_entity_id": "chw_only_one_of_four_products"
},
{
"key": "chw_only_two_of_four_products",
"text": "2 - Deux types d'aliments différents",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chw_one_animal_product_or_fruit"
"openmrs_entity_id": "chw_only_two_of_four_products"
},
{
"key": "chw_only_three_of_four_products",
"text": "3 - Trois types d'aliment différents",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chw_one_animal_product_or_fruit"
"openmrs_entity_id": "chw_only_three_of_four_products"
},
{
"key": "chw_all_of_four_products",
"text": "4 - Quatre types d'aliment différents",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chw_one_animal_product_or_fruit"
"openmrs_entity_id": "chw_all_of_four_products"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,35 +64,35 @@
"text": "0 - None of the 4 products",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chk_no_animal_products"
"openmrs_entity_id": "chk_none_of_four_products"
},
{
"key": "chw_only_one_of_four_products",
"text": "1 - Only 1 of the 4 products",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chw_one_animal_product_or_fruit"
"openmrs_entity_id": "chw_only_one_of_four_products"
},
{
"key": "chw_only_two_of_four_products",
"text": "2 - Only 2 of the 4 products",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chw_one_animal_product_or_fruit"
"openmrs_entity_id": "chw_only_two_of_four_products"
},
{
"key": "chw_only_three_of_four_products",
"text": "3 - Only 3 of the 4 products",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chw_one_animal_product_or_fruit"
"openmrs_entity_id": "chw_only_three_of_four_products"
},
{
"key": "chw_all_of_four_products",
"text": "4 - All 4 of the products",
"value": false,
"openmrs_entity": "concept",
"openmrs_entity_id": "chw_one_animal_product_or_fruit"
"openmrs_entity_id": "chw_all_of_four_products"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
package org.smartregister.chw.activity;

import org.smartregister.chw.R;
import org.smartregister.chw.anc.util.NCUtils;
import org.smartregister.chw.core.activity.DefaultChildMedicalHistoryActivityFlv;
import org.smartregister.chw.core.utils.CoreChildUtils;
import org.smartregister.chw.util.ChildUtilsFlv;

public class ChildMedicalHistoryActivityFlv extends DefaultChildMedicalHistoryActivityFlv {

@Override
public VisitDetailsFormatter getDieataryFormatter() {
return (title, details, visitDate) -> {
String diet_diversity = NCUtils.getText(details);
String value = "";
if ("chk_none_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.drc_minimum_dietary_choice_0);
} else if ("chw_only_one_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.drc_minimum_dietary_choice_1);
} else if ("chw_only_two_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.drc_minimum_dietary_choice_2);
} else if ("chw_only_three_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.drc_minimum_dietary_choice_3);
} else if ("chw_all_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.drc_minimum_dietary_choice_4);
}

return String.format("%s - %s %s",
value,
context.getString(org.smartregister.chw.core.R.string.done),
sdf.format(visitDate)
);
};
}

public CoreChildUtils.Flavor getChildUtils() {
return new ChildUtilsFlv();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public String evaluateSubTitle() {

String value = "";
if ("chk_none_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.minimum_dietary_choice_0);
value = context.getString(R.string.drc_minimum_dietary_choice_0);
} else if ("chw_only_one_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.minimum_dietary_choice_1);
value = context.getString(R.string.drc_minimum_dietary_choice_1);
} else if ("chw_only_two_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.minimum_dietary_choice_2);
value = context.getString(R.string.drc_minimum_dietary_choice_2);
} else if ("chw_only_three_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.minimum_dietary_choice_3);
value = context.getString(R.string.drc_minimum_dietary_choice_3);
} else if ("chw_all_of_four_products".equalsIgnoreCase(diet_diversity)) {
value = context.getString(R.string.minimum_dietary_choice_4);
value = context.getString(R.string.drc_minimum_dietary_choice_4);
}
return value;
}
Expand Down
6 changes: 0 additions & 6 deletions opensrp-chw/src/drc/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,5 @@
<string name="login_title">Communautés Amies des Enfants Suivi en Temps Réel - RDC</string>
<string name="nav_logo">CFC-RTM - RDC</string>

<string name="minimum_dietary_choice_0">0 - Aucun des 4 produits</string>
<string name="minimum_dietary_choice_1">1 - Un seul type d\'aliment</string>
<string name="minimum_dietary_choice_2">2 - Deux types d\'aliments différents</string>
<string name="minimum_dietary_choice_3">3 - Trois types d\'aliment différents</string>
<string name="minimum_dietary_choice_4">4 - Quatre types d\'aliment différents</string>

<string name="mcv_1">Rougeole 1/VAR1</string>
</resources>
5 changes: 0 additions & 5 deletions opensrp-chw/src/drc/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,4 @@
<string name="login_title">Communautés Amies des Enfants Suivi en Temps Réel - RDC</string>
<string name="nav_logo">CFC-RTM - RDC</string>

<string name="minimum_dietary_choice_0">0 - None of the 4 products</string>
<string name="minimum_dietary_choice_1">1 - Only 1 of the 4 products</string>
<string name="minimum_dietary_choice_2">2 - Only 2 of the 4 products</string>
<string name="minimum_dietary_choice_3">3 - Only 3 of the 4 products</string>
<string name="minimum_dietary_choice_4">4 - All 4 of the products</string>
</resources>
6 changes: 6 additions & 0 deletions opensrp-chw/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@
<string name="no_kit_received_hint">Aucun kit reçu</string>
<string name="kit_been_used_hint">Le kit a-t-il été utilisé?</string>
<string name="family_kit">Kit Familiale</string>

<string name="drc_minimum_dietary_choice_0">0 - Aucun des 4 produits</string>
<string name="drc_minimum_dietary_choice_1">1 - Un seul type d\'aliment</string>
<string name="drc_minimum_dietary_choice_2">2 - Deux types d\'aliments différents</string>
<string name="drc_minimum_dietary_choice_3">3 - Trois types d\'aliment différents</string>
<string name="drc_minimum_dietary_choice_4">4 - Quatre types d\'aliment différents</string>
<string name="anc_home_visit_delivery_kit_received">Kit d\'accouchement reçu</string>
<string name="delivery_kit">Kit d\'accouchement</string>
</resources>
8 changes: 8 additions & 0 deletions opensrp-chw/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,14 @@
<string name="no_kit_received_hint">No kit received</string>
<string name="kit_been_used_hint">Has the kit been used?</string>
<string name="family_kit">Family Kit</string>

<string name="drc_minimum_dietary_choice_0">0 - None of the 4 products</string>
<string name="drc_minimum_dietary_choice_1">1 - Only 1 of the 4 products</string>
<string name="drc_minimum_dietary_choice_2">2 - Only 2 of the 4 products</string>
<string name="drc_minimum_dietary_choice_3">3 - Only 3 of the 4 products</string>
<string name="drc_minimum_dietary_choice_4">4 - All 4 of the products</string>

<string name="anc_home_visit_delivery_kit_received">Delivery kit received</string>
<string name="delivery_kit">Delivery kit</string>

</resources>

0 comments on commit 1451bd4

Please sign in to comment.