You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/09/18 20:19:47 UTC

[incubator-ponymail-foal] branch master updated: agg value may be None

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c996f7  agg value may be None
6c996f7 is described below

commit 6c996f78ff49103502b8e113a62c0075ace29f17
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sat Sep 18 15:19:40 2021 -0500

    agg value may be None
---
 server/plugins/messages.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index 6bebf2c..cd3ed7b 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -461,8 +461,8 @@ async def get_years(session, query_defuzzed):
     youngest = datetime.datetime.fromtimestamp(0)
     if res["aggregations"]:
         aggs = res["aggregations"]
-        oldest = datetime.datetime.fromtimestamp(aggs["first"]["value"])
-        youngest = datetime.datetime.fromtimestamp(aggs["last"]["value"])
+        oldest = datetime.datetime.fromtimestamp(aggs["first"]["value"] or 0)
+        youngest = datetime.datetime.fromtimestamp(aggs["last"]["value"] or 0)
 
     return oldest.year, youngest.year, oldest.month, youngest.month