From cea640bf1f8addaf38157057eb34ed19cac12b42 Mon Sep 17 00:00:00 2001 From: Alex Konotop Date: Fri, 22 Feb 2019 12:13:23 +0700 Subject: [PATCH] Fixes #5 by making the cards displayed more standard --- .../teamtreehouse/flashy/services/FlashCardServiceImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java b/src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java index 5b660e9..bb24770 100644 --- a/src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java +++ b/src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java @@ -62,10 +62,9 @@ public FlashCard getNextFlashCardBasedOnViews(Map idToViewCounts) { continue; } Long lowestScore = idToViewCounts.get(leastViewedId); - if (entry.getValue() >= lowestScore) { - break; + if (entry.getValue() < lowestScore) { + leastViewedId = entry.getKey(); } - leastViewedId = entry.getKey(); } return flashCardRepository.findOne(leastViewedId); }