Opened 17 years ago
Closed 17 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:
- Show
Custom Query
from link in Milestone. (Status
areaccepted
,assigned
,new
andreopened
. Group byStatus
.) - Click Ticket and go.
- Close the ticket.
- 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)
Change History (7)
by , 17 years ago
Attachment: | patch.diff added |
---|
comment:2 by , 17 years ago
Milestone: | 0.11.1 → 0.11 |
---|
follow-ups: 4 5 comment:3 by , 17 years ago
Owner: | changed from | to
---|
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
30 30 from trac.ticket.api import TicketSystem 31 31 from trac.ticket.model import Ticket 32 32 from trac.util import Ranges 33 from trac.util.compat import groupby 33 from trac.util.compat import groupby, sorted 34 34 from trac.util.datefmt import to_timestamp, utc 35 35 from trac.util.html import escape, unescape 36 36 from trac.util.text import shorten_line, CRLF … … 525 525 if self.group: 526 526 group_key = ticket[self.group] 527 527 groups.setdefault(group_key, []).append(ticket) 528 if not groupsequence or group sequence[-1] != group_key:528 if not groupsequence or group_key not in groupsequence: 529 529 groupsequence.append(group_key) 530 groupsequence = sorted(groupsequence, reverse=self.groupdesc) 530 531 groupsequence = [(value, groups[value]) for value in groupsequence] 531 532 532 533 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.
comment:4 by , 17 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.
This is patch