From a653f0697cb74a1d6e2a5054876c51c9471ef1c7 Mon Sep 17 00:00:00 2001 From: Corey Shields Date: Sun, 11 Oct 2020 08:57:07 -0400 Subject: [PATCH] Fix export last week bug As reported in #433 there was a bug causing export requests for the last week to be treated as a last month export. Fixes #433 by treating the period variable as the int that it is. Also makes the preceding check a little easier to understand by being explicit against the None case. Signed-off-by: Corey Shields --- db/base/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/base/tasks.py b/db/base/tasks.py index 5282a9a..1495dd5 100644 --- a/db/base/tasks.py +++ b/db/base/tasks.py @@ -147,8 +147,8 @@ def export_frames(norad, user_id, period=None): exported_frameset.satellite = Satellite.objects.get(norad_cat_id=norad) exported_frameset.end = datetime.utcnow() - if period: - if period == '1': + if period is not None: + if period == 1: exported_frameset.start = make_aware(exported_frameset.end - timedelta(days=7)) suffix = 'week' else: