Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12091 closed defect (fixed)

Ticket ids in batch ticket notification should be sorted

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.10
Component: ticket system Version:
Severity: normal Keywords: notification
Cc: Branch:
Release Notes:
  • Sort ticket ids by priority in batch-modify event on timeline view and notification mail.
  • Add Message-ID header to batch-modify notification mail.
API Changes:
Internal Changes:

Description (last modified by Jun Omae)

Ticket ids in batch ticket notification are not sorted like this, though those are sorted in timeline view.

Batch modification to #886, #31, #53, #633, #918, #1084, #1113, #1890, #1962, ...

-- 
Tickets URL: <http://trac.edgewall.org/query?id=886%2C31%2C53%2C633%2C918%2C1084%2C1113%2C1890%2C1962%2C2035%2C2141%2C2463%2C3332%2C3386%2C3470%2C....
  • trac/ticket/notification.py

    diff --git a/trac/ticket/notification.py b/trac/ticket/notification.py
    index d34e3ee..35b334b 100644
    a b class BatchTicketNotifyEmail(NotifyEmail):  
    545545            self._notify(tickets, new_values, comment, action, author)
    546546
    547547    def _notify(self, tickets, new_values, comment, action, author):
     548        tickets = sorted(tickets)
    548549        self.tickets = tickets
    549550        self.reporter = ''
    550551        self.owner = ''
    551         changes_descr = '\n'.join(['%s to %s' % (prop, val)
    552                                    for (prop, val) in new_values.iteritems()])
    553         tickets_descr = ', '.join(['#%s' % t for t in tickets])
     552        changes_descr = '\n'.join('%s to %s' % (prop, val)
     553                                  for (prop, val) in new_values.iteritems())
     554        tickets_descr = ', '.join('#%s' % t for t in tickets)
    554555        subject = self.format_subj(tickets_descr)
    555         link = self.env.abs_href.query(id=','.join([str(t) for t in tickets]))
     556        link = self.env.abs_href.query(id=','.join(str(t) for t in tickets))
    556557        self.data.update({
    557558            'tickets_descr': tickets_descr,
    558559            'changes_descr': changes_descr,

Another suggestions for batch ticket notification mail:

  • Add unit tests. It seem to be no unit tests.
  • Add Message-ID header. Currently, SMTP server probably adds the header.

Attachments (1)

batchmod-event-timeline.png (52.7 KB ) - added by Jun Omae 5 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Jun Omae, 5 years ago

Description: modified (diff)
Owner: set to Jun Omae
Status: newassigned

comment:2 by Christian Boos, 5 years ago

Shouldn't the order be the one that was used in the batch modification view? If you want to sort by Id there, great, but there might be other options (prio?).

by Jun Omae, 5 years ago

Attachment: batchmod-event-timeline.png added

in reply to:  2 comment:3 by Jun Omae, 5 years ago

Shouldn't the order be the one that was used in the batch modification view? If you want to sort by Id there, great, but there might be other options (prio?).

It is hard to compare ticket ids in batchmod notification and batchmod events in timeline view to me, because ticket ids in the batchmod notification are unsorted. See batchmod-event-timeline.png.

I think order of ticket ids should be consistent in the batchmod notification and timeline view.

Last edited 5 years ago by Jun Omae (previous) (diff)

comment:4 by Christian Boos, 5 years ago

Sure, they should better be consistent, I was just questioning the pertinence of always sorting them by Id, as elsewhere we have the possibility to produce list of tickets in a given sequence:

[[TicketQuery(severity=critical,status=!closed,order=modified,desc=true,format=compact)]]

#221, #1, #10606, #4431, #5648, #4298, #1242, #1132, #1465, #2465

Probably not that important in the batch modification case, as the order chosen in that view is not as significant as when specified explicitly in a TicketQuery, so do as you prefer, I just wanted to mention that possible alternative ;-)

in reply to:  2 comment:5 by Ryan J Ollos, 5 years ago

Replying to cboos:

Shouldn't the order be the one that was used in the batch modification view? If you want to sort by Id there, great, but there might be other options (prio?).

In addition to the consistency argument, both views have a link to a custom query view with the tickets sorted by priority:

timeline:2015-05-26T11:59-0700

Batch modification to #4431, #1024, #4790, #8140, #1240, #1936, #3307, #379=
4, #3895, #3970, #4140, #4848, #5059, #6630, #7721, #7728, #8686, #9251, #9=
688, #10312, #10523, #10734, #2717, #4439, #2064, #10075 by rjollos:


Action: unassign

--
Tickets URL: <http://trac.edgewall.org/query?id=3D4431%2C1024%2C4790%2C8140=
%2C1240%2C1936%2C3307%2C3794%2C3895%2C3970%2C4140%2C4848%2C5059%2C6630%2C77=
21%2C7728%2C8686%2C9251%2C9688%2C10312%2C10523%2C10734%2C2717%2C4439%2C2064=
%2C10075>
The Trac Project <http://trac.edgewall.org/>
The Trac Project

I think it would be reasonable that the custom query view be the one used in batch modification. I'm not sure that would be such an easy change to make though.

comment:6 by Jun Omae, 5 years ago

Proposed changes in jomae.git@t12091. After the changes, the tickets' id with sorted by priority are shown in query link of timeline view and batch modify notification.

comment:7 by Jun Omae, 5 years ago

Milestone: 1.0.71.0.8

Retargeting to milestone:1.0.8 because the changes aren't small.

comment:8 by Ryan J Ollos, 5 years ago

Milestone: 1.0.81.0.9

comment:9 by Ryan J Ollos, 5 years ago

Milestone: 1.0.91.0.10

Moving tickets that appear to be uncompleted for milestone:1.0.9. Please move back to milestone:1.0.9 if the ticket can be completed by 2015-09-07 18:00 UTC.

comment:10 by Jun Omae, 5 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [14516] and merged to trunk in [14517].

comment:11 by Ryan J Ollos, 5 years ago

I rebased the changes for #11901 after this commit: [a982d22f/rjollos.git]. I added sort_tickets_by_priority to trac.ticket.model, and it's utilized in TicketFormatter._format_subj_batchmodify and TicketFormatter._format_plaintext_batchmodify. I couldn't see a way to avoid calling the function twice, but maybe there's a better solution.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae 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.