Edgewall Software
Modify

Opened 13 years ago

Closed 13 years ago

#6662 closed defect (fixed)

Display tickets twice in `Query results`.

Reported by: anonymous Owned by: osimons
Priority: normal Milestone: 0.11
Component: report system Version: 0.11b1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Sequence:

  1. Show Custom Query from link in Milestone. (Status are accepted, assigned, new and reopened. Group by Status.)
  2. Click Ticket and go.
  3. Close the ticket.
  4. Click Back to Query navigation.

and also, there is missing order for group (between cache and query returns).

I have a patch against source:trunk@6397. Review it, please.

Attachments (1)

patch.diff (706 bytes ) - added by anonymous 13 years ago.
This is patch

Download all attachments as: .zip

Change History (7)

by anonymous, 13 years ago

Attachment: patch.diff added

This is patch

comment:1 by anonymous, 13 years ago

Milestone: 0.11.1

I forgot to put the milestone

comment:2 by anonymous, 13 years ago

Milestone: 0.11.10.11

comment:3 by osimons, 13 years ago

Owner: changed from Matthew Good to osimons

Please don't set or change milestones as anonymous - certainly without explanation.

That said, I've looked at it and verified the problem where a new group is added based on changes to tickets in an 'active' query - it does not get sorted correctly. The patch is essentially the same, except compatibility with Python 2.3. As the 'group by' list is likely not going to be all that long, I don't see the need to add a variable to test if we need sorting.

  • trac/ticket/query.py

     
    3030from trac.ticket.api import TicketSystem
    3131from trac.ticket.model import Ticket
    3232from trac.util import Ranges
    33 from trac.util.compat import groupby
     33from trac.util.compat import groupby, sorted
    3434from trac.util.datefmt import to_timestamp, utc
    3535from trac.util.html import escape, unescape
    3636from trac.util.text import shorten_line, CRLF
     
    525525            if self.group:
    526526                group_key = ticket[self.group]
    527527                groups.setdefault(group_key, []).append(ticket)
    528                 if not groupsequence or groupsequence[-1] != group_key:
     528                if not groupsequence or group_key not in groupsequence:
    529529                    groupsequence.append(group_key)
     530        groupsequence = sorted(groupsequence, reverse=self.groupdesc)
    530531        groupsequence = [(value, groups[value]) for value in groupsequence]
    531532
    532533        return {'query': self,

It seems to work correctly with the patch.

I'll leave it for a couple of days to see if there are comments on the approach, if not I'll commit.

in reply to:  3 comment:4 by osimons, 13 years ago

Replying to osimons:

… - it does not get sorted correctly.

And of course; I also got double groups listing the same tickets again. The patch solves this main issue, naturally.

in reply to:  3 comment:5 by anonymous, 13 years ago

Thank you for the review. I think the patch is right, so please commit.

comment:6 by osimons, 13 years ago

Resolution: fixed
Status: newclosed

Committed as [6471].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from osimons to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.