File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/main/java/com/teamtreehouse/flashy/controllers Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 12
12
13
13
@ Controller
14
14
public class IndexController {
15
- public static final int AMOUNT_TO_SHOW = 5 ;
15
+ public static final int AMOUNT_TO_SHOW = 3 ;
16
16
private FlashCardService flashCardService ;
17
17
18
18
@ Autowired
@@ -31,10 +31,12 @@ public String index(Model model) {
31
31
ctaBuilder .append (", " );
32
32
}
33
33
}
34
- ctaBuilder .append (" and " );
35
34
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
+ }
38
40
model .addAttribute ("cta" , ctaBuilder .toString ());
39
41
model .addAttribute ("flashCardCount" , totalCount );
40
42
return "index" ;
You can’t perform that action at this time.
0 commit comments