From b14ec9a9282cb49951b790ce1b48b1a078616926 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sun, 15 Oct 2017 19:00:56 -0700 Subject: Refactor Chapter Ordering Logic 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. --- src/main/java/com/p4square/grow/model/Chapter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/p4square/grow/model/Chapter.java') diff --git a/src/main/java/com/p4square/grow/model/Chapter.java b/src/main/java/com/p4square/grow/model/Chapter.java index ac27de6..3306bf0 100644 --- a/src/main/java/com/p4square/grow/model/Chapter.java +++ b/src/main/java/com/p4square/grow/model/Chapter.java @@ -18,12 +18,12 @@ import com.fasterxml.jackson.annotation.JsonIgnore; * @author Jesse Morgan */ public class Chapter implements Cloneable { - private String mName; + private Chapters mName; private Map mVideos; - public Chapter(String name) { + public Chapter(Chapters name) { mName = name; - mVideos = new HashMap(); + mVideos = new HashMap<>(); } /** @@ -36,7 +36,7 @@ public class Chapter implements Cloneable { /** * @return The Chapter name. */ - public String getName() { + public Chapters getName() { return mName; } @@ -45,7 +45,7 @@ public class Chapter implements Cloneable { * * @param name The name of the chapter. */ - public void setName(final String name) { + public void setName(final Chapters name) { mName = name; } -- cgit v1.2.3