diff --git a/src/org/april/hebdobot/bot/hooks/FinishReviewHook.java b/src/org/april/hebdobot/bot/hooks/FinishReviewHook.java index 02b0391..3bc2800 100644 --- a/src/org/april/hebdobot/bot/hooks/FinishReviewHook.java +++ b/src/org/april/hebdobot/bot/hooks/FinishReviewHook.java @@ -69,6 +69,10 @@ public class FinishReviewHook extends Hook { bot.sendMessage(sender + ", vous n'êtes pas le conducteur de la réunion"); } + else if (bot.getReview().isEnded()) + { + bot.sendMessage("La revue est déjà finie."); + } else if (bot.getReview().getParticipants().size() == 0) { bot.sendMessage("Participation nulle détectée. La revue est ignorée."); @@ -76,7 +80,7 @@ public class FinishReviewHook extends Hook } else { - // + // End the review. bot.getReview().endReview(); // Load and update review statistics. @@ -105,7 +109,7 @@ public class FinishReviewHook extends Hook // Conclusion message in channel. String date = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE); - String textReview = ReviewReporter.report(datas, bot.getReview()); + String reviewText = ReviewReporter.report(datas, bot.getReview()); bot.sendMessage("% " + ReviewStatsReporter.reportReviewCount(datas)); // @@ -116,7 +120,7 @@ public class FinishReviewHook extends Hook { PastebinClient pastebinClient = new PastebinClient(bot.getPastebinSettings().getApiKey()); - String pastebinUrl = pastebinClient.paste(textReview, "Revue APRIL " + date, Private.UNLISTED); + String pastebinUrl = pastebinClient.paste(reviewText, "Revue APRIL " + date, Private.UNLISTED); bot.sendMessage("% Compte-rendu de la revue : " + pastebinUrl); } @@ -142,12 +146,12 @@ public class FinishReviewHook extends Hook logger.info("Create review directory: " + bot.getReviewDirectory().getAbsolutePath()); bot.getReviewDirectory().mkdirs(); } - FileUtils.writeStringToFile(reviewFile, textReview, StandardCharsets.UTF_8); + FileUtils.writeStringToFile(reviewFile, reviewText, StandardCharsets.UTF_8); logger.info("File review saved in: [{}]", reviewFile.getAbsolutePath()); } catch (final Exception exception) { - logger.error("Error during file writing", exception); + logger.error("Error during file writing.", exception); } bot.sendMessage("% Durée de la revue : " + bot.getReview().getDurationInMinutes() + " minutes"); diff --git a/src/org/april/hebdobot/bot/review/Review.java b/src/org/april/hebdobot/bot/review/Review.java index d4a9b3e..99a688b 100644 --- a/src/org/april/hebdobot/bot/review/Review.java +++ b/src/org/april/hebdobot/bot/review/Review.java @@ -317,6 +317,28 @@ public class Review return result; } + /** + * Checks if is ended. + * + * @return true, if is ended + */ + public boolean isEnded() + { + boolean result; + + if (this.endTime == null) + { + result = true; + } + else + { + result = false; + } + + // + return result; + } + /** * Checks if is owner. *