When creating new ticket make sure we pick
report with highest count so we don't end up
linking to unrelated report if clustering
splits the problem.
Closes #172.
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
pyfaf/bugzilla.py | 2 +-
pyfaf/storage/problem.py | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/pyfaf/bugzilla.py b/pyfaf/bugzilla.py
index 678a6d9..4b374d2 100644
--- a/pyfaf/bugzilla.py
+++ b/pyfaf/bugzilla.py
@@ -721,7 +721,7 @@ class Bugzilla(object):
logging.warning('Refusing to process problem with no reports.')
continue
- report = problem.reports[0]
+ report = problem.sorted_reports[0]
if not report.backtraces:
logging.warning('Refusing to process report with no backtrace.')
continue
diff --git a/pyfaf/storage/problem.py b/pyfaf/storage/problem.py
index 7242517..e8ee1a5 100644
--- a/pyfaf/storage/problem.py
+++ b/pyfaf/storage/problem.py
@@ -92,3 +92,11 @@ class Problem(GenericTable):
sorted by quality.
'''
return sorted(self.backtraces, key=lambda bt: bt.quality, reverse=True)
+
+ @property
+ def sorted_reports(self):
+ """
+ Return list of all reports sorted by report count.
+ """
+
+ return sorted(self.reports, key=lambda report: report.count, reverse=True)
--
1.8.1.4
Show replies by date