commit eeae0d2afab46d6ae86169cb34803bff4f8dbd29
parent 46af5495967f9389a56d09ee0c10a41b8ecd8294
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Mon, 12 Aug 2019 01:17:07 +0200
order of weights in reporting
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/error.py b/error.py
@@ -42,12 +42,9 @@ class ErrorCollection:
if 'weights' in keys:
bounds = [0, 0]
for chunk in self.verse.chunks:
- weights = chunk.get("weights", [0, 0])
- bounds[0] += weights[0]
- if len(weights) == 2:
- bounds[1] += weights[1]
- else:
- bounds[1] += weights[0]
+ weights = chunk.get("weights", [0])
+ bounds[0] += min(weights)
+ bounds[1] += max(weights)
bounds = [str(x) for x in bounds]
lines['weights'] += " (total: " + ('-'.join(bounds)
if bounds[1] > bounds[0] else bounds[0]) + ")"