Skip to content

Commit 79e6e36

Browse files
committed
Adresses bug described in #16 and the total count in the call to action was off
1 parent 3084619 commit 79e6e36

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ public String index(Model model) {
3131
ctaBuilder.append(", ");
3232
}
3333
}
34-
ctaBuilder.append(" and ");
3534
Long totalCount = flashCardService.getCurrentCount();
36-
ctaBuilder.append(totalCount);
37-
ctaBuilder.append(" more");
35+
if (totalCount > AMOUNT_TO_SHOW){
36+
ctaBuilder.append(" and ");
37+
ctaBuilder.append(totalCount - AMOUNT_TO_SHOW);
38+
ctaBuilder.append(" more");
39+
}
3840
model.addAttribute("cta", ctaBuilder.toString());
3941
model.addAttribute("flashCardCount", totalCount);
4042
return "index";

0 commit comments

Comments
 (0)