diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2017-10-15 19:00:56 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2017-10-15 19:00:56 -0700 |
commit | b14ec9a9282cb49951b790ce1b48b1a078616926 (patch) | |
tree | deada14d4a407de18812d0e72c32136a2de2caa5 /src/main/java/com/p4square/grow/tools/AttributeBackfillTool.java | |
parent | 79b8aacbb7b347bba9d14b1332666e7263a3a058 (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/main/java/com/p4square/grow/tools/AttributeBackfillTool.java')
-rw-r--r-- | src/main/java/com/p4square/grow/tools/AttributeBackfillTool.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/main/java/com/p4square/grow/tools/AttributeBackfillTool.java b/src/main/java/com/p4square/grow/tools/AttributeBackfillTool.java index d7fd2ff..bf9ee7f 100644 --- a/src/main/java/com/p4square/grow/tools/AttributeBackfillTool.java +++ b/src/main/java/com/p4square/grow/tools/AttributeBackfillTool.java @@ -9,6 +9,7 @@ import java.util.Date; import java.util.List; import java.util.Map; +import com.p4square.grow.model.*; import org.restlet.Client; import org.restlet.Context; import org.restlet.data.Protocol; @@ -24,10 +25,6 @@ import com.p4square.grow.backend.dynamo.DynamoKey; import com.p4square.grow.config.Config; -import com.p4square.grow.model.Chapter; -import com.p4square.grow.model.Playlist; -import com.p4square.grow.model.TrainingRecord; -import com.p4square.grow.model.VideoRecord; import com.p4square.grow.provider.JsonEncodedProvider; /** @@ -221,7 +218,7 @@ public class AttributeBackfillTool { Playlist playlist = record.getPlaylist(); chapters: - for (Map.Entry<String, Chapter> entry : playlist.getChaptersMap().entrySet()) { + for (Map.Entry<Chapters, Chapter> entry : playlist.getChaptersMap().entrySet()) { Chapter chapter = entry.getValue(); // Find completion date @@ -237,7 +234,7 @@ chapters: } } - String attributeName = "Training Complete - " + entry.getKey(); + String attributeName = "Training Complete - " + entry.getKey().toString().toLowerCase(); // Check if the user already has the attribute. List<Attribute> attributes = f1.getAttribute(userId, attributeName); |