findSimilarBugs() returns bug task you are using

Bug #666496 reported by Brian Murray on 2010-10-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
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

Brian Murray (brian-murray) wrote :

351626 is another example of this.

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) on 2010-10-27
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
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) on 2010-11-17
Changed in malone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers