diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
new file mode 100644
index 0000000..5dfbdec
--- /dev/null
+++ b/.idea/codeStyleSettings.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 164b970..02642ab 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -13,7 +13,7 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java b/src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java
index 5b660e9..651ef7c 100644
--- a/src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java
+++ b/src/main/java/com/teamtreehouse/flashy/services/FlashCardServiceImpl.java
@@ -1,8 +1,9 @@
package com.teamtreehouse.flashy.services;
+import static java.util.stream.Collectors.toList;
+
import com.teamtreehouse.flashy.domain.FlashCard;
import com.teamtreehouse.flashy.repositories.FlashCardRepository;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -12,8 +13,6 @@
import java.util.Map;
import java.util.Random;
-import static java.util.stream.Collectors.toList;
-
@Service
public class FlashCardServiceImpl implements FlashCardService {
private FlashCardRepository flashCardRepository;
@@ -62,10 +61,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);
}