From 844b6e59db7240fab1faef9265fa0ce1ac706ea4 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Thu, 20 Oct 2022 01:37:44 +1100 Subject: Account for null pop in histplorer.py --- backend/histplorer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/histplorer.py b/backend/histplorer.py index 5282592..e5c6c5a 100755 --- a/backend/histplorer.py +++ b/backend/histplorer.py @@ -271,7 +271,8 @@ def lookupEvents(start: HistDate | None, end: HistDate | None, ctg: str | None, results.append(eventEntryToResults(row)) # return results -def eventEntryToResults(row: tuple[int, str, int, int | None, int | None, int | None, int, str, int, int]) -> Event: +def eventEntryToResults( + row: tuple[int, str, int, int | None, int | None, int | None, int, str, int, int | None]) -> Event: eventId, title, start, startUpper, end, endUpper, fmt, ctg, imageId, pop = row """ Helper for converting an 'events' db entry into an Event object """ # Convert dates @@ -291,6 +292,8 @@ def eventEntryToResults(row: tuple[int, str, int, int | None, int | None, int | newDates[i] = HistDate(False, *jdnToJulian(n)) else: newDates[i] = HistDate(True, *jdnToGregorian(n)) + if pop is None: + pop = 0 # return Event(eventId, title, newDates[0], newDates[1], newDates[2], newDates[3], ctg, imageId, pop) -- cgit v1.2.3