diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2013-08-21 22:35:32 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2013-08-21 22:35:32 -0700 |
commit | 9b33aaf27cd8f73402ee9967c6b0fd76a90f8ebe (patch) | |
tree | 2f97ddb022299309d6e96f6e25bc2506295fda63 /src/com/p4square/grow/frontend/SurveyPageResource.java | |
parent | 883cfedc17921273cb6098de3a2c52f2a092aadc (diff) |
Adding images, creating circle questions and misc. fixes.
Diffstat (limited to 'src/com/p4square/grow/frontend/SurveyPageResource.java')
-rw-r--r-- | src/com/p4square/grow/frontend/SurveyPageResource.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/com/p4square/grow/frontend/SurveyPageResource.java b/src/com/p4square/grow/frontend/SurveyPageResource.java index 8145c0d..351eade 100644 --- a/src/com/p4square/grow/frontend/SurveyPageResource.java +++ b/src/com/p4square/grow/frontend/SurveyPageResource.java @@ -116,11 +116,18 @@ public class SurveyPageResource extends FreeMarkerPageResource { final Form form = new Form(entity); final String answerId = form.getFirstValue("answer"); final String direction = form.getFirstValue("direction"); + boolean justGoBack = false; // FIXME: Ugly hack if (mQuestionId == null || answerId == null || answerId.length() == 0) { - // Something is wrong. - setStatus(Status.CLIENT_ERROR_BAD_REQUEST); - return null; + if ("previous".equals(direction)) { + // Just go back + justGoBack = true; + + } else { + // Something is wrong. + setStatus(Status.CLIENT_ERROR_BAD_REQUEST); + return null; + } } try { @@ -138,7 +145,7 @@ public class SurveyPageResource extends FreeMarkerPageResource { } // Store answer - { + if (!justGoBack) { Map<String, String> answer = new HashMap<String, String>(); answer.put("answerId", answerId); JsonResponse response = backendPut("/accounts/" + mUserId + @@ -174,7 +181,7 @@ public class SurveyPageResource extends FreeMarkerPageResource { nextPage += "/account/training/" + score; } } - + } else { nextPage += "/account/assessment/question/" + nextQuestionId; } |