diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-04-01 14:55:28 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-04-01 14:55:28 +0100 |
| commit | 1e4d53e1f1e94db4219606d8cdd45da24ef45bbd (patch) | |
| tree | 6d8dfcb024e48d6866cd6af8537824cda1d9ec4b /app | |
| parent | Various fixes to get the app to work in docker (diff) | |
| download | AnnotateChange-1e4d53e1f1e94db4219606d8cdd45da24ef45bbd.tar.gz AnnotateChange-1e4d53e1f1e94db4219606d8cdd45da24ef45bbd.zip | |
handle zero division properly
Diffstat (limited to 'app')
| -rw-r--r-- | app/admin/routes.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/admin/routes.py b/app/admin/routes.py index 0f2a691..9658266 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -191,7 +191,10 @@ def manage_datasets(): for dataset in Dataset.query.all(): tasks = Task.query.filter_by(dataset_id=dataset.id).all() n_complete = len([t for t in tasks if t.done]) - perc = n_complete / len(tasks) * 100 + if len(tasks) == 0: + perc = float('nan') + else: + perc = n_complete / len(tasks) * 100 entry = { "id": dataset.id, "name": dataset.name, |
