From d29ffa900d58976903c9d0831f9fcbcc771c47f3 Mon Sep 17 00:00:00 2001 From: jorgepastorr Date: Mon, 11 Mar 2024 13:49:03 +0100 Subject: [PATCH] fix resource aggregations when not found dataset --- orchestra/contrib/resources/aggregations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orchestra/contrib/resources/aggregations.py b/orchestra/contrib/resources/aggregations.py index 8dd0ac0a..e4a7ae69 100644 --- a/orchestra/contrib/resources/aggregations.py +++ b/orchestra/contrib/resources/aggregations.py @@ -34,7 +34,8 @@ class Last(Aggregation): def filter(self, dataset, date=None): lastdataset = dataset.order_by('-id').first() - dataset = dataset.filter( launch_id=lastdataset.launch_id) + if lastdataset is not None: + dataset = dataset.filter( launch_id=lastdataset.launch_id) # now = timezone.now() # epoch = now - datetime.timedelta(minutes=2) # dataset = dataset.filter( created_at__range=(epoch, now ))