Skip to content

Commit 4944f5b

Browse files
authored
Merge pull request #13 from brigun/bogus-counting
Fixes #10, bogus counting issue.
2 parents 46866af + 8b7b9d2 commit 4944f5b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ public FlashCard getNextFlashCardBasedOnViews(Map<Long, Long> idToViewCounts) {
6262
continue;
6363
}
6464
Long lowestScore = idToViewCounts.get(leastViewedId);
65-
if (entry.getValue() >= lowestScore) {
66-
break;
65+
if (entry.getValue() < lowestScore) {
66+
leastViewedId = entry.getKey();
6767
}
68-
leastViewedId = entry.getKey();
6968
}
7069
return flashCardRepository.findOne(leastViewedId);
7170
}

0 commit comments

Comments
 (0)