From dd5a0be56a05e55e71843e37d02581b9424bbc6c Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sun, 1 Sep 2013 17:37:06 -0700 Subject: Adding video completion tracking to frontend --- .../grow/frontend/TrainingPageResource.java | 69 +--------------------- 1 file changed, 2 insertions(+), 67 deletions(-) (limited to 'src/com/p4square/grow/frontend/TrainingPageResource.java') diff --git a/src/com/p4square/grow/frontend/TrainingPageResource.java b/src/com/p4square/grow/frontend/TrainingPageResource.java index 459eb9a..ad7ea8d 100644 --- a/src/com/p4square/grow/frontend/TrainingPageResource.java +++ b/src/com/p4square/grow/frontend/TrainingPageResource.java @@ -65,7 +65,7 @@ public class TrainingPageResource extends FreeMarkerPageResource { } /** - * Return a page with a survey question. + * Return a page of videos. */ @Override protected Representation get() { @@ -121,75 +121,10 @@ public class TrainingPageResource extends FreeMarkerPageResource { } catch (Exception e) { cLog.fatal("Could not render page: " + e.getMessage(), e); setStatus(Status.SERVER_ERROR_INTERNAL); - return null; + return ErrorPage.RENDER_ERROR; } } - /** - * Record a survey answer and redirect to the next question. - */ - @Override - protected Representation post(Representation entity) { - return null; - /*final Form form = new Form(entity); - final String answerId = form.getFirstValue("answer"); - - if (mQuestionId == null || answerId == null || answerId.length() == 0) { - // Something is wrong. - setStatus(Status.CLIENT_ERROR_BAD_REQUEST); - return null; - } - - try { - // Find the question - Map questionData = null; - { - JsonResponse response = backendGet("/assessment/question/" + mQuestionId); - if (!response.getStatus().isSuccess()) { - // User is answering a question which doesn't exist - setStatus(Status.CLIENT_ERROR_NOT_FOUND); - return null; - } - - questionData = response.getMap(); - } - - // Store answer - { - Map answer = new HashMap(); - answer.put("answerId", answerId); - JsonResponse response = backendPut("/accounts/" + mUserId + - "/assessment/answers/" + mQuestionId, answer); - - if (!response.getStatus().isSuccess()) { - // Something went wrong talking to the backend, error out. - cLog.fatal("Error recording survey answer " + response.getStatus()); - setStatus(Status.SERVER_ERROR_INTERNAL); - return null; - } - } - - // Find the next question or finish the assessment. - String nextPage = mConfig.getString("dynamicRoot", ""); - { - String nextQuestionId = (String) questionData.get("nextQuestion"); - if (nextQuestionId == null) { - nextPage += "/account/assessment/results"; - } else { - nextPage += "/account/assessment/question/" + nextQuestionId; - } - } - - getResponse().redirectSeeOther(nextPage); - return null; - - } catch (Exception e) { - cLog.fatal("Could not render page: " + e.getMessage(), e); - setStatus(Status.SERVER_ERROR_INTERNAL); - return null; - }*/ - } - /** * @return The backend endpoint URI */ -- cgit v1.2.3