Correctif sur la sauvegarde des statistiques. Closes #9

This commit is contained in:
Mindiell 2024-07-23 21:46:06 +02:00
parent c4a3e78967
commit dc8edcf4c8
2 changed files with 12 additions and 1 deletions

View File

@ -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"
)

View File

@ -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")