-
Notifications
You must be signed in to change notification settings - Fork 41
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
Anc issue fix 906 for the human readable values not updating in events when the translation is on #892
Anc issue fix 906 for the human readable values not updating in events when the translation is on #892
Changes from all commits
3dda4b3
d041742
b0f0ee9
b78c9d4
98031b7
2b450bc
1284c31
b6809fb
987c3bb
b474095
06276b8
1067621
9dc6eb6
bedfc97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
package org.smartregister.service; | ||
|
||
import static org.smartregister.AllConstants.ENGLISH_LANGUAGE; | ||
import static org.smartregister.AllConstants.ENGLISH_LOCALE; | ||
import static org.smartregister.AllConstants.JURISDICTION_IDS; | ||
import static org.smartregister.AllConstants.KANNADA_LANGUAGE; | ||
import static org.smartregister.AllConstants.KANNADA_LOCALE; | ||
import static org.smartregister.AllConstants.OPENSRP_AUTH_USER_URL_PATH; | ||
import static org.smartregister.AllConstants.OPENSRP_LOCATION_URL_PATH; | ||
import static org.smartregister.AllConstants.OPERATIONAL_AREAS; | ||
import static org.smartregister.AllConstants.ORGANIZATION_IDS; | ||
import static org.smartregister.event.Event.ON_LOGOUT; | ||
|
||
import android.annotation.TargetApi; | ||
import android.os.Build; | ||
import android.os.Bundle; | ||
|
@@ -63,17 +74,6 @@ | |
|
||
import timber.log.Timber; | ||
|
||
import static org.smartregister.AllConstants.ENGLISH_LANGUAGE; | ||
import static org.smartregister.AllConstants.ENGLISH_LOCALE; | ||
import static org.smartregister.AllConstants.JURISDICTION_IDS; | ||
import static org.smartregister.AllConstants.KANNADA_LANGUAGE; | ||
import static org.smartregister.AllConstants.KANNADA_LOCALE; | ||
import static org.smartregister.AllConstants.OPENSRP_AUTH_USER_URL_PATH; | ||
import static org.smartregister.AllConstants.OPENSRP_LOCATION_URL_PATH; | ||
import static org.smartregister.AllConstants.OPERATIONAL_AREAS; | ||
import static org.smartregister.AllConstants.ORGANIZATION_IDS; | ||
import static org.smartregister.event.Event.ON_LOGOUT; | ||
|
||
public class UserService { | ||
private static final String KEYSTORE = "AndroidKeyStore"; | ||
private static final String CIPHER = "RSA/ECB/PKCS1Padding"; | ||
|
@@ -404,6 +404,7 @@ public void processLoginResponseDataForUser(String userName, LoginResponseData u | |
saveJurisdictions(userInfo.jurisdictions); | ||
saveJurisdictionIds(userInfo.jurisdictionIds); | ||
saveOrganizations(getUserTeam(userInfo)); | ||
saveUserId(userName, userInfo.user.getBaseEntityId()); | ||
if (loginSuccessful && | ||
(StringUtils.isBlank(getUserDefaultLocationId(userInfo)) || | ||
StringUtils.isNotBlank(allSharedPreferences.fetchDefaultLocalityId(username))) && | ||
|
@@ -848,4 +849,10 @@ public byte[] getGroupId(String userName, KeyStore.PrivateKeyEntry privateKeyEnt | |
} | ||
return null; | ||
} | ||
|
||
public void saveUserId(String userName, String baseEntityId) { | ||
if (userName != null) { | ||
allSharedPreferences.saveUserId(userName, baseEntityId); | ||
} | ||
} | ||
Comment on lines
+852
to
+857
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what we are using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these also came from https://github.com/opensrp/opensrp-client-core/pull/887/files |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -353,7 +353,14 @@ private static void createObsFromPopUpValues(Event event, JSONObject jsonObject, | |
popupJson.put(KEY, secondaryValueKey); | ||
popupJson.put(OPENMRS_ENTITY, CONCEPT); | ||
popupJson.put(OPENMRS_ENTITY_ID, parentOpenMRSAttributes.getString(OPENMRS_ENTITY_ID)); | ||
popupJson.put(VALUE, valueOpenMRSAttribute.getString(OPENMRS_ENTITY_ID)); | ||
if(valueOpenMRSAttribute.has(VALUE)) | ||
popupJson.put(VALUE, valueOpenMRSAttribute.getString(VALUE)); | ||
else | ||
popupJson.put(VALUE, valueOpenMRSAttribute.getString(OPENMRS_ENTITY_ID)); | ||
if(valueOpenMRSAttribute.has(TEXT)) | ||
popupJson.put(TEXT,valueOpenMRSAttribute.getString(TEXT)); | ||
if(valueOpenMRSAttribute.has(OPTIONS_FIELD_NAME)) | ||
popupJson.put(OPTIONS_FIELD_NAME,valueOpenMRSAttribute.getJSONArray(OPTIONS_FIELD_NAME)); | ||
Comment on lines
+356
to
+363
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please share a sample JSON for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dubdabasoduba in options only the selected key is added to avoid the extra looping when filling up the human readable values |
||
popupJson.put(AllConstants.TYPE, secondaryValueType); | ||
|
||
if (AllConstants.NATIVE_RADIO.equals(secondaryValueType) || | ||
|
@@ -534,7 +541,7 @@ private static void createObservation(Event e, JSONObject jsonObject, String val | |
List<Object> vall = new ArrayList<>(); | ||
|
||
String formSubmissionField = getString(jsonObject, KEY); | ||
String obsValue = value; | ||
String obsValue = Utils.extractTranslatableValue(value); | ||
|
||
String dataType = getString(jsonObject, OPENMRS_DATA_TYPE); | ||
if (StringUtils.isBlank(dataType)) { | ||
|
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.
@junaidwarsivd What does the
user id
do? Why are we concatenating it with theusername
?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.
@dubdabasoduba these changes are from the https://github.com/opensrp/opensrp-client-core/pull/887/files merge as it has some resolved codacy issues as well as these changes also needs to be merged in the targeted branch issue ref# opensrp/opensrp-client-anc#878