From b05faa983938cbdac39ca465d58d373d29552265 Mon Sep 17 00:00:00 2001 From: "Nico Pfiffner (nipfif)" Date: Sat, 2 Sep 2023 12:07:06 +0200 Subject: [PATCH] fix: Make report more robust. --- digital_meal/views.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/digital_meal/views.py b/digital_meal/views.py index d96df6e..af89cd5 100644 --- a/digital_meal/views.py +++ b/digital_meal/views.py @@ -88,9 +88,15 @@ def get_context_data(self, **kwargs): fav_video['title'] = video_titles.get(fav_video['id']) channels = yt_data.get_channels_from_history(watched_videos) - - n_videos_jun_to_aug = yt_data.filter_jun_to_aug(watched_videos).shape[0] - n_ads_jun_to_aug = yt_data.filter_jun_to_aug(seen_ads).shape[0] + try: + n_videos_jun_to_aug = yt_data.filter_jun_to_aug(watched_videos).shape[0] + except: + n_videos_jun_to_aug = None + + try: + n_ads_jun_to_aug = yt_data.filter_jun_to_aug(seen_ads).shape[0] + except: + n_ads_jun_to_aug = None context.update({ 'dates_plot': yt_plots.get_timeseries_plot(dates),