From 11e75b80d4c98688b9bbf92f6943e60d288e4365 Mon Sep 17 00:00:00 2001 From: "Fafner [_KeyZee_]" Date: Mon, 23 Dec 2024 15:03:38 +0100 Subject: [PATCH] Update abstract_chat_object.py https://github.com/ail-project/ail-framework/commit/9a388dc9cb05eec9f612343fcdf4579b18bf1e00 broke the Forum view, we can not do stat on forum, only on subchan :) --- bin/lib/objects/abstract_chat_object.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/lib/objects/abstract_chat_object.py b/bin/lib/objects/abstract_chat_object.py index 3987cc3a..ce291f65 100755 --- a/bin/lib/objects/abstract_chat_object.py +++ b/bin/lib/objects/abstract_chat_object.py @@ -228,11 +228,14 @@ class AbstractChatObject(AbstractSubtypeObject, ABC): return stats def get_message_years(self): - timestamp = datetime.utcfromtimestamp(float(self.get_timestamp_first_message())) - year_start = int(timestamp.strftime('%Y')) - timestamp = datetime.utcfromtimestamp(float(self.get_timestamp_last_message())) - year_end = int(timestamp.strftime('%Y')) - return list(range(year_start, year_end + 1)) + try: + timestamp = datetime.utcfromtimestamp(float(self.get_timestamp_first_message())) + year_start = int(timestamp.strftime('%Y')) + timestamp = datetime.utcfromtimestamp(float(self.get_timestamp_last_message())) + year_end = int(timestamp.strftime('%Y')) + return list(range(year_start, year_end + 1)) + except: + return [] def get_nb_year_messages(self, year): nb_year = {}