Edgewall Software

Ticket #6662 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

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:

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

patch.diff (0.7 KB) - added by anonymous 10 months ago.
This is patch

Change History

Changed 10 months ago by anonymous

This is patch

  Changed 10 months ago by anonymous

  • milestone set to 0.11.1

I forgot to put the milestone

  Changed 10 months ago by anonymous

  • milestone changed from 0.11.1 to 0.11

follow-ups: ↓ 4 ↓ 5   Changed 10 months ago by osimons

  • owner changed from mgood 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   Changed 10 months ago by osimons

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   Changed 10 months ago by anonymous

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

  Changed 10 months ago by osimons

  • status changed from new to closed
  • resolution set to fixed

Committed as [6471].

Add/Change #6662 (Display tickets twice in `Query results`.)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from osimons. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.