File tree Expand file tree Collapse file tree 5 files changed +60
-4
lines changed 
src/main/java/com/teamtreehouse/flashy/controllers Expand file tree Collapse file tree 5 files changed +60
-4
lines changed Original file line number Diff line number Diff line change 1+ <?xml  version =" 1.0"  encoding =" UTF-8" 
2+ <classpath >
3+ 	<classpathentry  kind =" src" path =" src/main/java" 
4+ 		<attributes >
5+ 			<attribute  name =" FROM_GRADLE_MODEL" value =" true" 
6+ 		</attributes >
7+ 	</classpathentry >
8+ 	<classpathentry  kind =" src" path =" src/main/resources" 
9+ 		<attributes >
10+ 			<attribute  name =" FROM_GRADLE_MODEL" value =" true" 
11+ 		</attributes >
12+ 	</classpathentry >
13+ 	<classpathentry  kind =" src" path =" src/test/java" 
14+ 	<classpathentry  kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" 
15+ 	<classpathentry  kind =" con" path =" org.eclipse.buildship.core.gradleclasspathcontainer" 
16+ 	<classpathentry  kind =" output" path =" bin" 
17+ </classpath >
Original file line number Diff line number Diff line change 6262
6363! gradle-wrapper.jar 
6464
65+ /bin /
Original file line number Diff line number Diff line change 1+ <?xml  version =" 1.0"  encoding =" UTF-8" 
2+ <projectDescription >
3+ 	<name >flashy</name >
4+ 	<comment ></comment >
5+ 	<projects >
6+ 	</projects >
7+ 	<buildSpec >
8+ 		<buildCommand >
9+ 			<name >org.eclipse.jdt.core.javabuilder</name >
10+ 			<arguments >
11+ 			</arguments >
12+ 		</buildCommand >
13+ 		<buildCommand >
14+ 			<name >org.eclipse.buildship.core.gradleprojectbuilder</name >
15+ 			<arguments >
16+ 			</arguments >
17+ 		</buildCommand >
18+ 	</buildSpec >
19+ 	<natures >
20+ 		<nature >org.eclipse.buildship.core.gradleprojectnature</nature >
21+ 		<nature >org.eclipse.jdt.core.javanature</nature >
22+ 	</natures >
23+ </projectDescription >
Original file line number Diff line number Diff line change 1+ build.commands =org.eclipse.jdt.core.javabuilder
2+ connection.arguments =
3+ connection.gradle.distribution =GRADLE_DISTRIBUTION(WRAPPER)
4+ connection.java.home =null
5+ connection.jvm.arguments =
6+ connection.project.dir =
7+ derived.resources =.gradle,build
8+ eclipse.preferences.version =1
9+ natures =org.eclipse.jdt.core.javanature
10+ project.path =\:
Original file line number Diff line number Diff line change 1212
1313@ Controller 
1414public  class  IndexController  {
15+   private  static  final  int  AMOUNT_TO_SHOW  = 3 ;
1516  private  FlashCardService  flashCardService ;
1617
1718  @ Autowired 
@@ -22,18 +23,22 @@ 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 (", " );
3132      }
3233    }
33-     ctaBuilder .append (" and " );
3434    Long  totalCount  = flashCardService .getCurrentCount ();
35-     ctaBuilder .append (totalCount );
36-     ctaBuilder .append (" more" );
35+     if (totalCount  > AMOUNT_TO_SHOW )
36+     {
37+     	ctaBuilder .append (" and " );
38+     	ctaBuilder .append (totalCount  - AMOUNT_TO_SHOW );
39+     	ctaBuilder .append (" more" );
40+     }
41+     
3742    model .addAttribute ("cta" , ctaBuilder .toString ());
3843    model .addAttribute ("flashCardCount" , totalCount );
3944    return  "index" ;
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments