Skip to content
This repository has been archived by the owner on Jan 18, 2019. It is now read-only.

Commit

Permalink
added some more logging and temporary bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
clennam committed Oct 22, 2017
1 parent 95c531c commit 454035c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/java/diaspora/forager/StartGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ private void loadQuestion() {
@Override
public void onResponse(String response) {
int questionNo = Integer.parseInt(counter.getText().toString()) - 1;
// Display the first 500 characters of the response string.
try {
JSONArray responseObject = new JSONArray(response);
JSONObject questionObject = new JSONObject(responseObject.getString(questionNo));
JSONObject revisionObject = new JSONObject(questionObject.getString("question"));
String questiontoRate = revisionObject.getString("revision_text");
question.setText(questiontoRate);
questionId = questionObject.getString("question_id");
Log.i("Question", questionId);
} catch (JSONException e) {
Log.e(TAG, "JSONException Occurred", e);
FirebaseCrash.report(e);
Expand Down Expand Up @@ -207,18 +207,22 @@ private Map buildParams() {

if (!comments.getText().toString().equals("")) {
params.put("comments", comments.getText().toString());
} else {
params.put("comments", "No comment supplied.");
}

return params;
}

private void pushAnswer() {
String url = SERVER + KEY + "/questions/" + questionId + "/answers/" + uid;
Log.i("URL", url);

Map<String, JSONObject> params = new HashMap<String, JSONObject>();
JSONObject answer = new JSONObject(buildParams());
Log.i("Answer", answer.toString());
params.put("answer", answer);
Log.i("AnswerFull", params.toString());
JsonObjectRequest req = new JsonObjectRequest(url, new JSONObject(params),
new Response.Listener<JSONObject>() {
@Override
Expand Down

0 comments on commit 454035c

Please sign in to comment.