From: Scott Baker Date: Thu, 15 May 2014 23:17:16 +0000 (-0700) Subject: fix divide by zero when no HPC slice exists X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=111702b09e2d82f0e5a94a6f331c5c19789fdbde;p=plstackapi.git fix divide by zero when no HPC slice exists --- diff --git a/planetstack/core/plus/views.py b/planetstack/core/plus/views.py index 705f4f6..3c63e16 100644 --- a/planetstack/core/plus/views.py +++ b/planetstack/core/plus/views.py @@ -517,6 +517,8 @@ class TenantPickSitesView(View): class DashboardSummaryAjaxView(View): def get(self, request, **kwargs): def avg(x): + if len(x)==0: + return 0 return float(sum(x))/len(x) sites = getCDNOperatorData().values()