Edgewall Software

Ticket #1064 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

sort version combo descending in new ticket form

Reported by: Dirk <trac@…> Owned by: cboos
Priority: normal Milestone: 0.9.4
Component: ticket system Version: 0.8
Severity: normal Keywords:
Cc: manuzhai@…

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

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

Change History

Changed 4 years ago by Dirk <trac@…>

patch for descending sort order of the version number field

Changed 4 years ago by Manuzhai

This makes sense, would be nice to have.

Changed 4 years ago by anonymous

  • cc manuzhai@… added

Changed 3 years ago by deminix@…

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

Changed 3 years ago by Gunnar Wagenknecht <gunnar@…>

  • cc gunnar@… added

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • milestone set to 0.9.4

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

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

Changed 3 years ago by cboos

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) 

Changed 3 years ago by cboos

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

Implemented the above in r2767 and r2768.

Changed 2 years ago by anonymous

  • cc gunnar@… removed

Changed 2 years ago by anonymous

lll

Add/Change #1064 (sort version combo descending in new ticket form)

Author



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