diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2013-09-15 16:57:53 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2013-09-15 16:57:53 -0700 |
commit | 48af9ac4779b2d60889b0159f47442b5d6d9c8ce (patch) | |
tree | c51a021f4da706dede8c5360c8916da812c63e1e /src/com/p4square/grow | |
parent | c68f0faf73b92993875d8e7365427a54ff84fbaa (diff) |
Adding Introduction Chapter.
Introduction chapter is always required and thus after the assessment
the user is taken directly to the introduction. After the introduction
training continues with whichever section the user assessed in to.
Diffstat (limited to 'src/com/p4square/grow')
3 files changed, 23 insertions, 6 deletions
diff --git a/src/com/p4square/grow/backend/resources/TrainingRecordResource.java b/src/com/p4square/grow/backend/resources/TrainingRecordResource.java index 8447c16..009d0fe 100644 --- a/src/com/p4square/grow/backend/resources/TrainingRecordResource.java +++ b/src/com/p4square/grow/backend/resources/TrainingRecordResource.java @@ -32,7 +32,7 @@ import com.p4square.grow.backend.db.CassandraDatabase; * @author Jesse Morgan <jesse@jesterpm.net> */ public class TrainingRecordResource extends ServerResource { - private static final String[] CHAPTERS = { "seeker", "believer", "disciple", "teacher" }; + private static final String[] CHAPTERS = { "introduction", "seeker", "believer", "disciple", "teacher" }; private static final Logger LOG = Logger.getLogger(TrainingRecordResource.class); private static final ObjectMapper MAPPER = new ObjectMapper(); @@ -211,8 +211,15 @@ public class TrainingRecordResource extends ServerResource { // Get videos for each section and build playlist for (String chapter : CHAPTERS) { - // Chapter required if the floor of the score is <= the chapter's numeric value. - boolean required = score < Score.numericScore(chapter) + 1; + boolean required; + + if ("introduction".equals(chapter)) { + // Introduction chapter is always required + required = true; + } else { + // Chapter required if the floor of the score is <= the chapter's numeric value. + required = score < Score.numericScore(chapter) + 1; + } ColumnList<String> row = mDb.getRow("strings", "/training/" + chapter); if (!row.isEmpty()) { diff --git a/src/com/p4square/grow/frontend/ChapterCompletePage.java b/src/com/p4square/grow/frontend/ChapterCompletePage.java index 671e45e..2f981ae 100644 --- a/src/com/p4square/grow/frontend/ChapterCompletePage.java +++ b/src/com/p4square/grow/frontend/ChapterCompletePage.java @@ -102,6 +102,14 @@ public class ChapterCompletePage extends FreeMarkerPageResource { } } + // Skip the chapter complete message for "Introduction" + if ("introduction".equals(mChapter)) { + String nextPage = mConfig.getString("dynamicRoot", ""); + nextPage += "/account/training/" + nextChapter; + getResponse().redirectSeeOther(nextPage); + return new StringRepresentation("Redirecting to " + nextPage); + } + root.put("stage", mChapter); root.put("nextstage", nextChapter); return new TemplateRepresentation(t, root, MediaType.TEXT_HTML); diff --git a/src/com/p4square/grow/frontend/TrainingPageResource.java b/src/com/p4square/grow/frontend/TrainingPageResource.java index af49bc0..b27d86e 100644 --- a/src/com/p4square/grow/frontend/TrainingPageResource.java +++ b/src/com/p4square/grow/frontend/TrainingPageResource.java @@ -96,8 +96,8 @@ public class TrainingPageResource extends FreeMarkerPageResource { } if (mChapter == null) { - // Everything is completed... send them back to seeker. - mChapter = "seeker"; + // Everything is completed... send them back to introduction. + mChapter = "introduction"; } String nextPage = mConfig.getString("dynamicRoot", ""); @@ -185,8 +185,10 @@ public class TrainingPageResource extends FreeMarkerPageResource { return 3; } else if ("believer".equals(chapter)) { return 2; - } else { + } else if ("seeker".equals(chapter)) { return 1; + } else { + return 0; } } } |