Improve invalid delta error reporting.

This commit is contained in:
Darko Poljak 2018-10-18 11:35:41 +02:00
parent 5bd4baf661
commit 6bece1437e

View file

@ -30,7 +30,6 @@ import os.path
import re import re
import glob import glob
import collections import collections
import sys
import ctt import ctt
import ctt.listprojects import ctt.listprojects
@ -227,15 +226,16 @@ class Report(object):
"""Return all entries""" """Return all entries"""
count = 0 count = 0
for entry in self._report_db.values(): for dirname, entry in self._report_db.items():
delta = entry['delta'] delta = entry['delta']
log.debug("Adding %s to %s time..." % (delta, count)) log.debug("Adding %s to %s time..." % (delta, count))
try: try:
count = count + float(delta) count = count + float(delta)
except ValueError: except ValueError:
log.warning("Invalid delta in entry {entry} for project " log.warning("1 Invalid delta entry {entry} for {dirname} for "
"{project}, skipping for total time.".format( "project {project}, skipping for total "
entry=entry, project=self.project)) "time.".format(entry=entry, dirname=dirname,
project=self.project))
continue continue
return count return count
@ -271,9 +271,10 @@ class Report(object):
try: try:
report = self._get_report_entry(time, entry) report = self._get_report_entry(time, entry)
except ValueError: except ValueError:
log.warning("Invalid delta in entry {entry} for project " log.warning("2 Invalid delta entry {entry} for {dirname} for "
"{project}, skipping for report.".format( "project {project}, skipping".format(
entry=entry, project=self.project)) entry=entry, dirname=time,
project=self.project))
continue continue
if time not in entries: if time not in entries:
entries[time] = [report] entries[time] = [report]