#654: Rows in ticket query result set not sorted by column ---------------------------+----------------------------------- Reporter: olemis | Owner: gjm Type: defect | Status: accepted Priority: blocker | Milestone: Release 8 Component: multiproduct | Version: Resolution: | Keywords: ticket query, sorting ---------------------------+-----------------------------------
Comment (by olemis): Replying to [comment:8 gjm]: > I've been considering this one for a while now. The immediate problem is that lists of enums (Type, Status, Resolution, Priority and Severity for example) are not available as the query to select them is restricted to the product that they are performed in. This makes a bit less sense at the top level where there are none. > > There are a number of ways to deal with this, one of which includes providing an extra variable on the env object to determine whether to force a db_direct_query and decorate the !AbstractEnum.select method to choose when no product is selected. I do not understand , I've tried something similar to this and still query does not sort tickets by ID are why do we need to add an extra attribute in the environment object ? The issue mentioned in comment:5 is just about label , I mean , column header is ''Ticket'' whereas values in column are priorities . > This would look something like: > {{{ > #!python > import copy > from trac.ticket import model > > from functools import wraps > > def direct_query_override(f): > @classmethod > @wraps(f) > def decorator(cls, env, *args, **kwargs): > kwargs.pop('db', None) > denv = copy.copy(env) > if not getattr(denv, 'product', None): > denv._db_direct_override = True > return f.__get__(True).im_func(cls, denv, *args, **kwargs) > return decorator > > model.AbstractEnum.select = direct_query_override(model.AbstractEnum.select) > }}} > I'm not sure about this ... IMO we better keep them scoped to a given product and add a separate method to list all enums in all products , `select_all` ? Notice that there's a case for retrieving all enums in different products . > That still leaves a bit to do about including: > * duplicate removal + > * restricting returned values based on permissions + > * decide whether we care that enums may end up with different priorities in different products Should be important , maybe for highlighting . -- Ticket URL: <https://issues.apache.org/bloodhound/ticket/654#comment:9> Apache Bloodhound <https://issues.apache.org/bloodhound/> The Apache Bloodhound issue tracker