Skip to content

Commit 6913cce

Browse files
committed
Addresses issue #6 by where the total count in the call to action was off
1 parent f74a2a6 commit 6913cce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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)