Ignore, warn and continue in case of invalid delta
This commit is contained in:
parent
d6098d2464
commit
e422738085
3 changed files with 16 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -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))
|
||||
count = count + float(delta)
|
||||
|
||||
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]
|
||||
report = self._get_report_entry(time, entry)
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue