diff --git a/.idea/compiler.xml b/.idea/compiler.xml index c6a834d..f54de62 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,8 +1,6 @@ - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 164b970..df60b67 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,19 +1,6 @@ - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/.idea/modules/flashy.iml b/.idea/modules/flashy.iml index 2f6b1cf..91b9bed 100644 --- a/.idea/modules/flashy.iml +++ b/.idea/modules/flashy.iml @@ -5,6 +5,7 @@ + diff --git a/.idea/modules/flashy_main.iml b/.idea/modules/flashy_main.iml index 3d7e5d1..54f6893 100644 --- a/.idea/modules/flashy_main.iml +++ b/.idea/modules/flashy_main.iml @@ -1,7 +1,7 @@ - - + + @@ -9,71 +9,74 @@ - - - + + + - - - - - - - - + + + + + + + + - + - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + + + + + - - - - - + + - + - + \ No newline at end of file diff --git a/.idea/modules/flashy_test.iml b/.idea/modules/flashy_test.iml index 3c5b73a..1476f16 100644 --- a/.idea/modules/flashy_test.iml +++ b/.idea/modules/flashy_test.iml @@ -1,7 +1,7 @@ - - + + @@ -10,74 +10,77 @@ - - - + + + - - - - - - - - + + + + + + + + - + - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + + + + + - - - - - + + - + - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index c89d069..24e0a48 100644 --- a/build.gradle +++ b/build.gradle @@ -4,9 +4,13 @@ version '1.0-SNAPSHOT' buildscript { repositories { mavenCentral() + maven { url "https://repo.spring.io/plugins-snapshot" } + maven { url "https://repo.spring.io/snapshot" } + maven { url "https://repo.spring.io/milestone" } } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE") + classpath "io.spring.gradle:dependency-management-plugin:0.6.0.BUILD-SNAPSHOT" + classpath('org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE') } } @@ -14,15 +18,13 @@ buildscript { apply plugin: 'java' apply plugin: 'spring-boot' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 repositories { mavenCentral() } dependencies { - compile 'org.springframework.boot:spring-boot-starter-web' + compile 'org.springframework.boot:spring-boot-starter-web:2.0.3.RELEASE' compile 'org.springframework.boot:spring-boot-starter-data-jpa' compile 'org.springframework.boot:spring-boot-starter-thymeleaf' compile 'com.h2database:h2' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2c388f7..99c9e6a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java index f127754..79d476d 100644 --- a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java +++ b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java @@ -12,6 +12,7 @@ @Controller public class IndexController { + public static final int AMOUNT_TO_SHOW = 3; private FlashCardService flashCardService; @Autowired @@ -22,7 +23,7 @@ public void setFlashCardService(FlashCardService flashCardService) { @RequestMapping("/") public String index(Model model) { StringBuilder ctaBuilder = new StringBuilder(); - List cards = flashCardService.getRandomFlashCards(5); + List cards = flashCardService.getRandomFlashCards(AMOUNT_TO_SHOW); ctaBuilder.append("Refresh your memory about "); for (FlashCard card : cards) { ctaBuilder.append(card.getTerm()); @@ -30,10 +31,12 @@ public String index(Model model) { ctaBuilder.append(", "); } } - ctaBuilder.append(" and "); Long totalCount = flashCardService.getCurrentCount(); - ctaBuilder.append(totalCount); - ctaBuilder.append(" more"); + if (totalCount > AMOUNT_TO_SHOW) { + ctaBuilder.append(" and "); + ctaBuilder.append(totalCount - AMOUNT_TO_SHOW); + ctaBuilder.append(" more"); + } model.addAttribute("cta", ctaBuilder.toString()); model.addAttribute("flashCardCount", totalCount); return "index";