Commit e4227380 authored by Darko Poljak's avatar Darko Poljak

Ignore, warn and continue in case of invalid delta

parent d6098d24
......@@ -4,6 +4,7 @@ lib/ctt/__pycache__/
# -vim
.*.swp
.ropeproject
# Manpages
*.1
......@@ -3,6 +3,7 @@ Changelog
* Changes are always commented with their author in (braces)
* Exception: No braces means author == Nico Schottelius
* Ignore, warn and continue in case of invalid delta (Darko Poljak)
1.1: 2017-02-16
* Ignore non matching patterns for report command (Darko Poljak)
......
......@@ -229,8 +229,13 @@ class Report(object):
for entry in self._report_db.values():
delta = entry['delta']
log.debug("Adding %s to %s time..." % (delta, count))
try:
count = count + float(delta)
except ValueError:
log.warning("Invalid delta in entry {entry} for project "
"{project}, skipping for total time.".format(
entry=entry, project=self.project))
continue
return count
def _get_report_entry(self, time, entry):
......@@ -261,7 +266,13 @@ class Report(object):
time_keys = self._report_db.keys()
for time in time_keys:
entry = self._report_db[time]
try:
report = self._get_report_entry(time, entry)
except ValueError:
log.warning("Invalid delta in entry {entry} for project "
"{project}, skipping for report.".format(
entry=entry, project=self.project))
continue
if time not in entries:
entries[time] = [report]
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment