diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..b9d18bf
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index c6a834d..6116051 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,8 +1,6 @@
-
-
@@ -13,12 +11,9 @@
-
-
-
-
-
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 164b970..d5d79e0 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,19 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 0b6b7df..7863940 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,9 +2,9 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/flashy.iml b/.idea/modules/com.teamtreehouse.flashy.iml
similarity index 92%
rename from .idea/modules/flashy.iml
rename to .idea/modules/com.teamtreehouse.flashy.iml
index 2f6b1cf..91b9bed 100644
--- a/.idea/modules/flashy.iml
+++ b/.idea/modules/com.teamtreehouse.flashy.iml
@@ -5,6 +5,7 @@
+
diff --git a/.idea/modules/flashy_main.iml b/.idea/modules/com.teamtreehouse.flashy.main.iml
similarity index 98%
rename from .idea/modules/flashy_main.iml
rename to .idea/modules/com.teamtreehouse.flashy.main.iml
index 3d7e5d1..44c5005 100644
--- a/.idea/modules/flashy_main.iml
+++ b/.idea/modules/com.teamtreehouse.flashy.main.iml
@@ -1,7 +1,7 @@
-
-
+
+
diff --git a/.idea/modules/flashy_test.iml b/.idea/modules/com.teamtreehouse.flashy.test.iml
similarity index 97%
rename from .idea/modules/flashy_test.iml
rename to .idea/modules/com.teamtreehouse.flashy.test.iml
index 3c5b73a..b40e237 100644
--- a/.idea/modules/flashy_test.iml
+++ b/.idea/modules/com.teamtreehouse.flashy.test.iml
@@ -1,7 +1,7 @@
-
-
+
+
@@ -9,7 +9,7 @@
-
+
@@ -79,5 +79,5 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java
index f127754..14509f8 100644
--- a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java
+++ b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java
@@ -12,6 +12,7 @@
@Controller
public class IndexController {
+ private static final int AMOUNT_TO_SHOW = 3;
private FlashCardService flashCardService;
@Autowired
@@ -22,18 +23,20 @@ public void setFlashCardService(FlashCardService flashCardService) {
@RequestMapping("/")
public String index(Model model) {
StringBuilder ctaBuilder = new StringBuilder();
- List cards = flashCardService.getRandomFlashCards(5);
+ List cards = flashCardService.getRandomFlashCards(AMOUNT_TO_SHOW);
ctaBuilder.append("Refresh your memory about ");
for (FlashCard card : cards) {
ctaBuilder.append(card.getTerm());
- if (card != cards.get(cards.size() - 1)) {
+ if (card != cards.get(cards.size() - 1)) {
ctaBuilder.append(", ");
}
}
- ctaBuilder.append(" and ");
Long totalCount = flashCardService.getCurrentCount();
- ctaBuilder.append(totalCount);
- ctaBuilder.append(" more");
+ if (totalCount > AMOUNT_TO_SHOW) {
+ ctaBuilder.append(" and ");
+ ctaBuilder.append(totalCount - AMOUNT_TO_SHOW);
+ ctaBuilder.append(" more");
+ }
model.addAttribute("cta", ctaBuilder.toString());
model.addAttribute("flashCardCount", totalCount);
return "index";