Skip to content

Commit 02f4496

Browse files
committed
Addresses issue treehouse-projects#6 choosing number of examples
1 parent beed2a1 commit 02f4496

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
@Controller
1414
public class IndexController {
15+
public static final int AMOUNT_TO_SHOW = 3;
1516
private FlashCardService flashCardService;
1617

1718
@Autowired
@@ -22,12 +23,13 @@ public void setFlashCardService(FlashCardService flashCardService) {
2223
@RequestMapping("/")
2324
public String index(Model model) {
2425
StringBuilder ctaBuilder = new StringBuilder();
25-
List<FlashCard> cards = flashCardService.getRandomFlashCards(5);
26+
List<FlashCard> cards = flashCardService.getRandomFlashCards(AMOUNT_TO_SHOW);
2627
ctaBuilder.append("Refresh your memory about ");
2728
for (FlashCard card : cards) {
2829
ctaBuilder.append(card.getTerm());
2930
if (card != cards.get(cards.size() - 1)) {
3031
ctaBuilder.append(", ");
32+
3133
}
3234
}
3335
ctaBuilder.append(" and ");

0 commit comments

Comments
 (0)