From 1d7d477bad73debe5d120e9d315512632b0fec8f Mon Sep 17 00:00:00 2001 From: Oldtowner Date: Mon, 27 Mar 2017 11:43:20 +0100 Subject: [PATCH 1/2] Addresses issue #6 by changing number of examples to 3. --- .../teamtreehouse/flashy/controllers/IndexController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java index f127754..b79a453 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()); @@ -32,7 +33,7 @@ public String index(Model model) { } ctaBuilder.append(" and "); Long totalCount = flashCardService.getCurrentCount(); - ctaBuilder.append(totalCount); + ctaBuilder.append(totalCount - AMOUNT_TO_SHOW); ctaBuilder.append(" more"); model.addAttribute("cta", ctaBuilder.toString()); model.addAttribute("flashCardCount", totalCount); From 67036daa67f95c2a7a992d59205bd913b1835105 Mon Sep 17 00:00:00 2001 From: Oldtowner Date: Mon, 27 Mar 2017 17:40:09 +0100 Subject: [PATCH 2/2] Added oxford comma. --- .../com/teamtreehouse/flashy/controllers/IndexController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java index b79a453..7b9c3b3 100644 --- a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java +++ b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java @@ -31,7 +31,7 @@ public String index(Model model) { ctaBuilder.append(", "); } } - ctaBuilder.append(" and "); + ctaBuilder.append(", and "); Long totalCount = flashCardService.getCurrentCount(); ctaBuilder.append(totalCount - AMOUNT_TO_SHOW); ctaBuilder.append(" more");