From b2ae18ae9427eb2ce9038086f069423b3116214c Mon Sep 17 00:00:00 2001 From: Alison Parker Date: Sun, 11 Nov 2018 21:31:33 +1100 Subject: [PATCH 1/4] fixed Gradle compatibility issue updated style to Google Style --- .idea/misc.xml | 12 +--- .idea/modules/flashy.iml | 1 + .idea/modules/flashy_main.iml | 88 ++++++++++++------------ .idea/modules/flashy_test.iml | 88 ++++++++++++------------ build.gradle | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 96 insertions(+), 101 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 164b970..9c38ba8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,17 +3,7 @@ - - - - - - - - - - - + \ 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..16a93a4 100644 --- a/.idea/modules/flashy_main.iml +++ b/.idea/modules/flashy_main.iml @@ -1,7 +1,7 @@ - - + + @@ -9,71 +9,71 @@ - - - + + + - - - - - - - - + + + + + + + + - + - - - - + + + + + + + + + + + + - - - - + + + + - - - - - - - - - + + + + + + - - - - - - - - + + + + + + - - - - + - + \ No newline at end of file diff --git a/.idea/modules/flashy_test.iml b/.idea/modules/flashy_test.iml index 3c5b73a..275249b 100644 --- a/.idea/modules/flashy_test.iml +++ b/.idea/modules/flashy_test.iml @@ -1,7 +1,7 @@ - - + + @@ -10,74 +10,74 @@ - - - + + + - - - - - - - - + + + + + + + + - + - - - - + + + + + + + + + + + + - - - - + + + + - - - - - - - - - + + + + + + - - - - - - - - + + + + + + - - - - + - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index c89d069..67dba03 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') } } 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 From eb8d5da90aafab1c9efb082d474af0e589780d6d Mon Sep 17 00:00:00 2001 From: Alison Parker Date: Sun, 11 Nov 2018 21:46:17 +1100 Subject: [PATCH 2/4] Fixed issue with compilation (think was issue with spring version). --- .idea/compiler.xml | 11 ++--------- .idea/misc.xml | 5 +---- .idea/modules/flashy_main.iml | 25 ++++++++++++++----------- .idea/modules/flashy_test.iml | 25 ++++++++++++++----------- build.gradle | 4 +--- 5 files changed, 32 insertions(+), 38 deletions(-) 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 9c38ba8..df60b67 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,9 +1,6 @@ - - - - + \ No newline at end of file diff --git a/.idea/modules/flashy_main.iml b/.idea/modules/flashy_main.iml index 16a93a4..54f6893 100644 --- a/.idea/modules/flashy_main.iml +++ b/.idea/modules/flashy_main.iml @@ -1,6 +1,6 @@ - + @@ -10,16 +10,16 @@ - + - + - + @@ -42,18 +42,21 @@ + + + + - - - - - + + + + @@ -65,8 +68,8 @@ - - + + diff --git a/.idea/modules/flashy_test.iml b/.idea/modules/flashy_test.iml index 275249b..1476f16 100644 --- a/.idea/modules/flashy_test.iml +++ b/.idea/modules/flashy_test.iml @@ -1,6 +1,6 @@ - + @@ -11,17 +11,17 @@ - + - + - + @@ -45,18 +45,21 @@ + + + + - - - - - + + + + @@ -68,8 +71,8 @@ - - + + diff --git a/build.gradle b/build.gradle index 67dba03..24e0a48 100644 --- a/build.gradle +++ b/build.gradle @@ -18,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' From b5aa9382d8293b51aca35b9781d3fabb7ba1327f Mon Sep 17 00:00:00 2001 From: Alison Parker Date: Thu, 15 Nov 2018 22:18:10 +1100 Subject: [PATCH 3/4] Addresses issue #6 by changing the number of examples to 3 --- .../com/teamtreehouse/flashy/controllers/IndexController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java index f127754..6ebbcac 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()); From fda4ff44aa71f9a2304f768792a2df876a228e4e Mon Sep 17 00:00:00 2001 From: Alison Parker Date: Thu, 15 Nov 2018 22:34:58 +1100 Subject: [PATCH 4/4] Addresses bug described in #6 where total count in the call to action was off --- .../teamtreehouse/flashy/controllers/IndexController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java index 6ebbcac..79d476d 100644 --- a/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java +++ b/src/main/java/com/teamtreehouse/flashy/controllers/IndexController.java @@ -31,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";