diff --git a/CHANGELOG.md b/CHANGELOG.md index c36542a..b7d0d3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ # Changelog All notable changes to this project will be documented in this file. -## 0.2 - YYYY-MM-DD +## 0.2.1 - 2014-12-10 +### Fixed +- Review advice output rounding bug. Should now round correctly and output right ammount of sessions. + +## 0.2 - 2014-12-09 ### Added -- Change log (this file). +- Automatic adding of reviewer based on git blame. ## 0.1 - 2014-11-22 ### Added diff --git a/pom.xml b/pom.xml index 1a47c1d..8d027a2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.nexception.reviewassistant reviewassistant jar - 0.2 + 0.2.1 reviewassistant diff --git a/src/main/java/com/github/nexception/reviewassistant/ReviewAssistant.java b/src/main/java/com/github/nexception/reviewassistant/ReviewAssistant.java index db87aa6..e2ce7e2 100644 --- a/src/main/java/com/github/nexception/reviewassistant/ReviewAssistant.java +++ b/src/main/java/com/github/nexception/reviewassistant/ReviewAssistant.java @@ -120,6 +120,8 @@ public static Calculation calculate(PatchSetCreatedEvent event) { private static int calculateReviewTime(PatchSetCreatedEvent event) { int lines = event.patchSet.sizeInsertions + Math.abs(event.patchSet.sizeDeletions); int minutes = (int) Math.ceil(lines / 5); + minutes = (int) Math.ceil(minutes / 5.0); + minutes = minutes * 5; if(minutes < 5) { minutes = 5; } @@ -133,7 +135,7 @@ private static int calculateReviewTime(PatchSetCreatedEvent event) { * @return the recommended amount of review sessions */ private static int calculateReviewSessions(int minutes) { - int sessions = Math.round(minutes / 60); + int sessions = (int) Math.round(minutes / 60.0); if (sessions < 1) { sessions = 1; } diff --git a/src/main/java/com/github/nexception/reviewassistant/rest/GetAdvice.java b/src/main/java/com/github/nexception/reviewassistant/rest/GetAdvice.java index b2dcf85..9cae2d6 100644 --- a/src/main/java/com/github/nexception/reviewassistant/rest/GetAdvice.java +++ b/src/main/java/com/github/nexception/reviewassistant/rest/GetAdvice.java @@ -42,7 +42,7 @@ public Object apply(RevisionResource resource) throws AuthException, BadRequestE advice += calculation.minutes + " minutes"; } advice += " reviewing this change."; - if (calculation.sessions > 1) { + if (calculation.hours >= 1) { advice += "
This should be split up in " + calculation.sessions + " to " + (calculation.sessions + 1) + " sessions.
"; }