summaryrefslogtreecommitdiff
path: root/src/test/java/com/p4square/grow/backend/resources
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2017-10-15 19:00:56 -0700
committerJesse Morgan <jesse@jesterpm.net>2017-10-15 19:00:56 -0700
commitb14ec9a9282cb49951b790ce1b48b1a078616926 (patch)
treedeada14d4a407de18812d0e72c32136a2de2caa5 /src/test/java/com/p4square/grow/backend/resources
parent79b8aacbb7b347bba9d14b1332666e7263a3a058 (diff)
Refactor Chapter Ordering Logic20171015
The bug impacting the CCB integration was due to the "Introduction" chapter having a higher "score" than every other chapter. It was a mistake to use Score to compared chapter progress, particularly since there are more chapters than scores. This change gathers the chapter ordering logic, which was scattered throughout the code into a new Chapters enum. Playlist and Chapter now use Chapters as a key, instead of loose strings. Same for the ProgressReporter interface.
Diffstat (limited to 'src/test/java/com/p4square/grow/backend/resources')
-rw-r--r--src/test/java/com/p4square/grow/backend/resources/TrainingRecordResourceTest.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/test/java/com/p4square/grow/backend/resources/TrainingRecordResourceTest.java b/src/test/java/com/p4square/grow/backend/resources/TrainingRecordResourceTest.java
index db85051..8a052ef 100644
--- a/src/test/java/com/p4square/grow/backend/resources/TrainingRecordResourceTest.java
+++ b/src/test/java/com/p4square/grow/backend/resources/TrainingRecordResourceTest.java
@@ -7,6 +7,7 @@ package com.p4square.grow.backend.resources;
import java.util.Map;
import java.util.HashMap;
+import com.p4square.grow.model.Chapters;
import org.restlet.data.Method;
import org.restlet.Request;
import org.restlet.Response;
@@ -46,13 +47,13 @@ public class TrainingRecordResourceTest extends ResourceTestBase {
mResponse = new Response(mRequest);
Playlist playlist = new Playlist();
- playlist.add("introduction", "intro-1");
- playlist.add("seeker", "seeker-1");
- playlist.add("believer", "believer-1");
- playlist.add("believer", "believer-2");
- playlist.add("disciple", "disciple-1");
- playlist.add("teacher", "teacher-1");
- playlist.add("leader", "leader-1");
+ playlist.add(Chapters.INTRODUCTION, "intro-1");
+ playlist.add(Chapters.SEEKER, "seeker-1");
+ playlist.add(Chapters.BELIEVER, "believer-1");
+ playlist.add(Chapters.BELIEVER, "believer-2");
+ playlist.add(Chapters.DISCIPLE, "disciple-1");
+ playlist.add(Chapters.TEACHER, "teacher-1");
+ playlist.add(Chapters.LEADER, "leader-1");
mApplication.setDefaultPlaylist(playlist);
}