From 77f7cf4844ac54b98436ca4d5a0db0878452fdb9 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 20 Dec 2019 16:41:54 +0100 Subject: [PATCH] returning 0 is makeplot gives no image --- rowers/tasks.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/rowers/tasks.py b/rowers/tasks.py index aec4f4d6..d39ca012 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -1887,13 +1887,16 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename, t += ' - Power Distribution' fig1 = row.get_power_piechart(t) - if fig1: - canvas = FigureCanvas(fig1) + if fig1 is None: + return 0 - canvas.print_figure('static/plots/' + imagename) - plt.close(fig1) - fig1.clf() - gc.collect() + + canvas = FigureCanvas(fig1) + + canvas.print_figure('static/plots/' + imagename) + plt.close(fig1) + fig1.clf() + gc.collect() return imagename