Implemented workaround. We create our own ids instead of using CommCare case_id.

parent 1993caeb
......@@ -14,6 +14,8 @@ import com.aluxoft.earrecognition.common.EarIdList;
import com.aluxoft.earrecognition.common.NameDistance;
import com.google.gson.Gson;
import java.util.UUID;
/**
* Shows top 10 matches, allows to register if not match is satisfactory.
* TODO: Populate list
......@@ -59,7 +61,9 @@ public class SelectFollowupActivity extends Activity {
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SelectFollowupActivity.this.setResult(Activity.RESULT_OK, new Intent());
Intent intent = new Intent();
intent.putExtra("case_id", UUID.randomUUID().toString());
SelectFollowupActivity.this.setResult(Activity.RESULT_OK, intent);
finish();
}
});
......
......@@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
/**
* Callout to transfer features to CommCare
......@@ -61,6 +62,11 @@ public class IntentTransferingFeatures extends Activity {
try {
_showTransferringMessage();
Intent returningIntent = new Intent(getIntent());
Bundle responses = new Bundle();
responses.putString("ear_id", UUID.randomUUID().toString());
returningIntent.putExtra("odk_intent_bundle", responses);
returningIntent.putExtra(
"odk_intent_data",
FileUtils.readFileToString(
......@@ -147,6 +153,11 @@ public class IntentTransferingFeatures extends Activity {
String list = data.getStringExtra("list");
EarIdList earIdList = new Gson().fromJson(list, EarIdList.class);
Intent returningIntent = new Intent(getIntent());
Bundle responses = new Bundle();
responses.putString("ear_id", UUID.randomUUID().toString());
returningIntent.putExtra("odk_intent_bundle", responses);
returningIntent.putExtra(
"odk_intent_data",
earIdList.getCurrentFeature().serializeFeatures()
......
......@@ -52,7 +52,7 @@ public class EarDataLoaderCommcare extends EarDataLoader {
gender = caseCursor.getString(caseCursor.getColumnIndex("value"));
} else */if (datumId.equals("features")) {
features = caseCursor.getString(caseCursor.getColumnIndex("value"));
} else if (datumId.equals("case_id_internal")) { // ToDo: Remplazarlo con una mejor forma
} else if (datumId.equals("ear_id")) { // ToDo: Remplazarlo con una mejor forma
caseId = caseCursor.getString(caseCursor.getColumnIndex("value"));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment