From 6bece1437eaa293335270cf58f6071d7418d8936 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Thu, 18 Oct 2018 11:35:41 +0200 Subject: [PATCH] Improve invalid delta error reporting. --- lib/ctt/report.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/ctt/report.py b/lib/ctt/report.py index 065f6ea..2357021 100755 --- a/lib/ctt/report.py +++ b/lib/ctt/report.py @@ -30,7 +30,6 @@ import os.path import re import glob import collections -import sys import ctt import ctt.listprojects @@ -227,15 +226,16 @@ class Report(object): """Return all entries""" count = 0 - for entry in self._report_db.values(): + for dirname, entry in self._report_db.items(): 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)) + log.warning("1 Invalid delta entry {entry} for {dirname} for " + "project {project}, skipping for total " + "time.".format(entry=entry, dirname=dirname, + project=self.project)) continue return count @@ -271,9 +271,10 @@ class Report(object): 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)) + log.warning("2 Invalid delta entry {entry} for {dirname} for " + "project {project}, skipping".format( + entry=entry, dirname=time, + project=self.project)) continue if time not in entries: entries[time] = [report]