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/f1oauth/F1ProgressReporter.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/f1oauth/F1ProgressReporter.java')
-rw-r--r-- | src/main/java/com/p4square/f1oauth/F1ProgressReporter.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/com/p4square/f1oauth/F1ProgressReporter.java b/src/main/java/com/p4square/f1oauth/F1ProgressReporter.java index 8382020..1514043 100644 --- a/src/main/java/com/p4square/f1oauth/F1ProgressReporter.java +++ b/src/main/java/com/p4square/f1oauth/F1ProgressReporter.java @@ -1,6 +1,7 @@ package com.p4square.f1oauth; import com.p4square.grow.frontend.ProgressReporter; +import com.p4square.grow.model.Chapters; import org.apache.log4j.Logger; import org.restlet.security.User; @@ -29,8 +30,8 @@ public class F1ProgressReporter implements ProgressReporter { } @Override - public void reportChapterComplete(final User user, final String chapter, final Date date) { - final String attributeName = "Training Complete - " + chapter; + public void reportChapterComplete(final User user, final Chapters chapter, final Date date) { + final String attributeName = "Training Complete - " + chapter.toString().toLowerCase(); final Attribute attribute = new Attribute(attributeName); attribute.setStartDate(date); addAttribute(user, attribute); |