Edgewall Software
Modify

Opened 20 years ago

Closed 19 years ago

Last modified 11 years ago

#1064 closed defect (fixed)

sort version combo descending in new ticket form

Reported by: Dirk <trac@…> Owned by: Christian Boos
Priority: normal Milestone: 0.9.4
Component: ticket system Version: 0.8
Severity: normal Keywords:
Cc: manuzhai@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

It be more natural to sort the versions combo box descending for the new ticket and ticket view?

Most bugs are filed against the jungest version of a software. If you have lots of versions you have to scroll down evertime. This change has also the side effect that the default version is set to unspecified for new issues if not specified in the trac.ini file.

A similar change would be interesting for the milestone field, as long as the milestones are related to the version number. Bugzilla has a sort order key for this to be able to sort also non numeric and non alphabetical orderd milestones correctly.

Attachments (1)

version_order.patch (1.2 KB ) - added by Dirk <trac@…> 20 years ago.
patch for descending sort order of the version number field

Download all attachments as: .zip

Change History (10)

by Dirk <trac@…>, 20 years ago

Attachment: version_order.patch added

patch for descending sort order of the version number field

comment:1 by Manuzhai, 20 years ago

This makes sense, would be nice to have.

comment:2 by anonymous, 20 years ago

Cc: manuzhai@… added

comment:3 by deminix@…, 20 years ago

i agree that a DESC order is good, but it should be ordered by the date/time attribute of a version, not its string sort order.

those without times specified should sort before those that do, imo

comment:4 by Gunnar Wagenknecht <gunnar@…>, 19 years ago

Cc: gunnar@… added

comment:5 by Christian Boos, 19 years ago

Milestone: 0.9.4
Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

Something similar to r2758 and r2760 could be done for versions, too.

(and this should take care of the version part of #1150)

comment:6 by Christian Boos, 19 years ago

e.g.

  • trac/ticket/model.py

     
    724724        if not db:
    725725            db = env.get_db_cnx()
    726726        cursor = db.cursor()
    727         cursor.execute("SELECT name,time,description FROM version "
    728                        "ORDER BY COALESCE(time,0),name")
     727        cursor.execute("SELECT name,time,description FROM version")
     728        versions = []
    729729        for name, time, description in cursor:
    730             component = cls(env)
    731             component.name = name
    732             component.time = time and int(time) or None
    733             component.description = description or ''
    734             yield component
     730            version = cls(env)
     731            version.name = name
     732            version.time = time and int(time) or None
     733            version.description = description or ''
     734            versions.append(version)
     735        def version_order(v):
     736            return (v.time or sys.maxint, embedded_numbers(v.name))
     737        return sorted(versions, key=version_order, reverse=True)
    735738    select = classmethod(select)

comment:7 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Implemented the above in r2767 and r2768.

comment:8 by anonymous, 18 years ago

Cc: gunnar@… removed

comment:10 by kubes@…, 11 years ago

#consider reopen due to #11325

Modify Ticket

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