findSimilarBugs() returns bug task you are using

Bug #666496 reported by Brian Murray
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Brian Murray

Bug Description

Occasionally, when using findSimilarBugs with bug tasks you are returned the bug task for the bug report you were initially querying from.

For example:

In [6]: bug = launchpad.bugs[428017]
In [7]: [bug.id for bug in bug.bug_tasks[0].findSimilarBugs()]
Out[7]: [428017]

This doesn't seem terribly useful to me.

Related branches

Revision history for this message
Brian Murray (brian-murray) wrote :

351626 is another example of this.

Revision history for this message
Brian Murray (brian-murray) wrote :

I think this occurs because the exact same bug task is excluded but we are returning bugs and not bug tasks, so if you have a bug with multiple tasks one of the additional tasks will be returned.

From lib/lp/bugs/model/bugtask.py:

        matching_bugtasks = [
            bug_task for bug_task in matching_bugtasks[:4*limit]
            if bug_task != self]

        matching_bugs = getUtility(IBugSet).getDistinctBugsForBugTasks(
            matching_bugtasks, user, limit)
        return matching_bugs

So 'if bug_task.bug.id != self.bug.id' would likely resolve this.

Gavin Panella (allenap)
tags: added: trivial
Changed in malone:
importance: Undecided → Low
status: New → Triaged
Changed in malone:
assignee: nobody → Brian Murray (brian-murray)
status: Triaged → In Progress
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
Changed in malone:
milestone: none → 10.11
tags: added: qa-needstesting
Changed in malone:
status: In Progress → Fix Committed
tags: added: qa-ok
removed: qa-needstesting
Curtis Hovey (sinzui)
Changed in malone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.