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 | |
parent | 883cfedc17921273cb6098de3a2c52f2a092aadc (diff) |
Adding images, creating circle questions and misc. fixes.
Diffstat (limited to 'src/com/p4square')
3 files changed, 16 insertions, 8 deletions
diff --git a/src/com/p4square/grow/backend/resources/Question.java b/src/com/p4square/grow/backend/resources/Question.java index c53883c..e90ca77 100644 --- a/src/com/p4square/grow/backend/resources/Question.java +++ b/src/com/p4square/grow/backend/resources/Question.java @@ -10,12 +10,12 @@ import java.util.Map; /** * Model of an assessment question. - * + * * @author Jesse Morgan <jesse@jesterpm.net> */ class Question { public static enum QuestionType { - TEXT, IMAGE, SLIDER, QUAD; + TEXT, IMAGE, SLIDER, QUAD, CIRCLE; } private final String mQuestionId; @@ -45,7 +45,7 @@ class Question { mAnswers.put(id, answerObj); } } - + public String getId() { return mQuestionId; } diff --git a/src/com/p4square/grow/backend/resources/SurveyResultsResource.java b/src/com/p4square/grow/backend/resources/SurveyResultsResource.java index db7dad0..5e4a8bb 100644 --- a/src/com/p4square/grow/backend/resources/SurveyResultsResource.java +++ b/src/com/p4square/grow/backend/resources/SurveyResultsResource.java @@ -186,6 +186,7 @@ public class SurveyResultsResource extends ServerResource { score.count++; break; + case CIRCLE: case QUAD: scoreQuad(score, question, answerId); break; 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; } |