From 4857c96a6b87835fe3dfcc2fed76880c10c3199b Mon Sep 17 00:00:00 2001 From: Alex Lewis Date: Sun, 8 Jul 2018 22:23:52 -0400 Subject: [PATCH 1/3] Modify(IndexController): Change number of examples to 3 --- .idea/codeStyles/codeStyleConfig.xml | 5 +++++ .../teamtreehouse/flashy/controllers/IndexController.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .idea/codeStyles/codeStyleConfig.xml 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/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java index f127754..6ebbcac 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 { + public static final int AMOUNT_TO_SHOW = 3; private FlashCardService flashCardService; @Autowired @@ -22,7 +23,7 @@ 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()); From 1e00cacfcaffa2e617f2e879cb0718898bff7c80 Mon Sep 17 00:00:00 2001 From: Alex Lewis Date: Sun, 8 Jul 2018 22:25:06 -0400 Subject: [PATCH 2/3] Modify(PROJECT): Modify the .idea structure --- .idea/.name | 1 - .idea/compiler.xml | 26 --------- .idea/copyright/profiles_settings.xml | 3 - .idea/encodings.xml | 6 -- .idea/misc.xml | 16 +----- .idea/modules.xml | 10 ---- .idea/modules/flashy.iml | 12 ---- .idea/modules/flashy_main.iml | 79 ------------------------- .idea/modules/flashy_test.iml | 83 --------------------------- .idea/vcs.xml | 2 +- 10 files changed, 3 insertions(+), 235 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/copyright/profiles_settings.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/modules/flashy.iml delete mode 100644 .idea/modules/flashy_main.iml delete mode 100644 .idea/modules/flashy_test.iml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 5d223b0..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -flashy \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index c6a834d..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 164b970..bc8d0a3 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,19 +1,7 @@ - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 0b6b7df..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/flashy.iml b/.idea/modules/flashy.iml deleted file mode 100644 index 2f6b1cf..0000000 --- a/.idea/modules/flashy.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/flashy_main.iml b/.idea/modules/flashy_main.iml deleted file mode 100644 index 3d7e5d1..0000000 --- a/.idea/modules/flashy_main.iml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/flashy_test.iml b/.idea/modules/flashy_test.iml deleted file mode 100644 index 3c5b73a..0000000 --- a/.idea/modules/flashy_test.iml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file From 0fae3388241e334ee506265d674faf31174ed599 Mon Sep 17 00:00:00 2001 From: Alex Lewis Date: Sun, 8 Jul 2018 22:36:08 -0400 Subject: [PATCH 3/3] Modify(IndexController): Fix the CTA count logic --- .../teamtreehouse/flashy/controllers/IndexController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java index 6ebbcac..79d476d 100644 --- a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java +++ b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java @@ -31,10 +31,12 @@ public String index(Model model) { 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";