Improved code.
This commit is contained in:
parent
935bdeed07
commit
dbbb9da4d6
|
@ -69,6 +69,10 @@ public class FinishReviewHook extends Hook
|
||||||
{
|
{
|
||||||
bot.sendMessage(sender + ", vous n'êtes pas le conducteur de la réunion");
|
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)
|
else if (bot.getReview().getParticipants().size() == 0)
|
||||||
{
|
{
|
||||||
bot.sendMessage("Participation nulle détectée. La revue est ignorée.");
|
bot.sendMessage("Participation nulle détectée. La revue est ignorée.");
|
||||||
|
@ -76,7 +80,7 @@ public class FinishReviewHook extends Hook
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
// End the review.
|
||||||
bot.getReview().endReview();
|
bot.getReview().endReview();
|
||||||
|
|
||||||
// Load and update review statistics.
|
// Load and update review statistics.
|
||||||
|
@ -105,7 +109,7 @@ public class FinishReviewHook extends Hook
|
||||||
|
|
||||||
// Conclusion message in channel.
|
// Conclusion message in channel.
|
||||||
String date = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
|
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));
|
bot.sendMessage("% " + ReviewStatsReporter.reportReviewCount(datas));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -116,7 +120,7 @@ public class FinishReviewHook extends Hook
|
||||||
{
|
{
|
||||||
PastebinClient pastebinClient = new PastebinClient(bot.getPastebinSettings().getApiKey());
|
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);
|
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());
|
logger.info("Create review directory: " + bot.getReviewDirectory().getAbsolutePath());
|
||||||
bot.getReviewDirectory().mkdirs();
|
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());
|
logger.info("File review saved in: [{}]", reviewFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
catch (final Exception exception)
|
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");
|
bot.sendMessage("% Durée de la revue : " + bot.getReview().getDurationInMinutes() + " minutes");
|
||||||
|
|
|
@ -317,6 +317,28 @@ public class Review
|
||||||
return result;
|
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.
|
* Checks if is owner.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue