From 90880feea5db18755b92f02ddfc6497e30da4362 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20K=C3=B6gl?= Date: Fri, 5 Jun 2015 21:35:12 +0000 Subject: [PATCH] [Episodes] fix heatmap calculation --- mygpo/web/heatmap.py | 2 +- mygpo/web/templatetags/charts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mygpo/web/heatmap.py b/mygpo/web/heatmap.py index 98f7b627..2ea1e0fd 100644 --- a/mygpo/web/heatmap.py +++ b/mygpo/web/heatmap.py @@ -94,7 +94,7 @@ class EpisodeHeatmap(object): def max_plays(self): """ Returns the highest number of plays of all sections """ - return max(self.heatmap) + return max(self.heatmap, default=0) @property @query_if_required() diff --git a/mygpo/web/templatetags/charts.py b/mygpo/web/templatetags/charts.py index b3736e6a..413a0b4a 100644 --- a/mygpo/web/templatetags/charts.py +++ b/mygpo/web/templatetags/charts.py @@ -110,7 +110,7 @@ def episode_heatmap_visualization(heatmap): axis_label = [] part_colours = [] widths = [] - duration = max(heatmap.borders) + duration = max(heatmap.borders, default=0) last_label = None for start, end, plays in heatmap.sections: -- 2.11.4.GIT