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
|
# -vim
|
||||||
.*.swp
|
.*.swp
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
# Manpages
|
# Manpages
|
||||||
*.1
|
*.1
|
||||||
|
|
|
@ -3,6 +3,7 @@ Changelog
|
||||||
|
|
||||||
* Changes are always commented with their author in (braces)
|
* Changes are always commented with their author in (braces)
|
||||||
* Exception: No braces means author == Nico Schottelius
|
* Exception: No braces means author == Nico Schottelius
|
||||||
|
* Ignore, warn and continue in case of invalid delta (Darko Poljak)
|
||||||
|
|
||||||
1.1: 2017-02-16
|
1.1: 2017-02-16
|
||||||
* Ignore non matching patterns for report command (Darko Poljak)
|
* Ignore non matching patterns for report command (Darko Poljak)
|
||||||
|
|
|
@ -229,8 +229,13 @@ class Report(object):
|
||||||
for entry in self._report_db.values():
|
for entry in self._report_db.values():
|
||||||
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:
|
||||||
count = count + float(delta)
|
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
|
return count
|
||||||
|
|
||||||
def _get_report_entry(self, time, entry):
|
def _get_report_entry(self, time, entry):
|
||||||
|
@ -261,7 +266,13 @@ class Report(object):
|
||||||
time_keys = self._report_db.keys()
|
time_keys = self._report_db.keys()
|
||||||
for time in time_keys:
|
for time in time_keys:
|
||||||
entry = self._report_db[time]
|
entry = self._report_db[time]
|
||||||
|
try:
|
||||||
report = self._get_report_entry(time, entry)
|
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:
|
if time not in entries:
|
||||||
entries[time] = [report]
|
entries[time] = [report]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue