From dc8edcf4c8ed5416a1024de7f7196b3056cf9c80 Mon Sep 17 00:00:00 2001 From: Mindiell Date: Tue, 23 Jul 2024 21:46:06 +0200 Subject: [PATCH] Correctif sur la sauvegarde des statistiques. Closes #9 --- review/stats.py | 5 ++++- tests/test_complete_review.py | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/review/stats.py b/review/stats.py index 472a175..d098587 100644 --- a/review/stats.py +++ b/review/stats.py @@ -174,7 +174,10 @@ class ReviewStats: def save(self): with open(self.filepath, "w") as file_handle: for data in self.datas: + duration = "" + if data.duration is not None: + duration = f"\t{data.duration}" file_handle.write( f"{data.date.strftime('%Y%m%d-%Hh%M')}\t" - f"{data.user_count}\t{data.duration}\n" + f"{data.user_count}{duration}\n" ) diff --git a/tests/test_complete_review.py b/tests/test_complete_review.py index fc8527a..a46c643 100644 --- a/tests/test_complete_review.py +++ b/tests/test_complete_review.py @@ -52,3 +52,11 @@ def test_other_review(bot): with open("tests/reviews/20240402-log-irc-revue-hebdomadaire.txt") as file_handle: content_tested = file_handle.read() assert content_ok in content_tested + + +def test_fast_review(bot): + bot.test_public_message(bot.channel, "lllll", "!start") + bot.test_public_message(bot.channel, "lllll", "# new test") + bot.test_public_message(bot.channel, "lllll", "test") + bot.test_public_message(bot.channel, "lllll", "!fin") + bot.test_public_message(bot.channel, "lllll", "!stats")