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@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 f135655..a8db6ec 100644 --- a/pyfaf/bugzilla.py +++ b/pyfaf/bugzilla.py @@ -713,7 +713,7 @@ class Bugzilla(object): # pick first and assign this bug to it data['component'] = components.pop()
- 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)