Opened 6 years ago

# Don't show tickets with "negative" resolutions in the chart

Reported by: Owned by: Ryan J Ollos Chris Nelson normal TracJsGanttPlugin normal falkb 0.11

### Description

We use the Gantt chart to display all tickets associated with a milestone and it would be nice to have tickets with any "negative" resolution hidden by default (e.g. duplicate, invalid, ...). I guess this probably needs to be made an option.

### comment:1 Changed 6 years ago by Ryan J Ollos

Here is a quick patch that implements the behavior I would like to have on my Trac install. I could do the additional work of implementing an option for controlling the behavior, if you are interested in integrating this into the mainline.

What makes the most sense to me is to specify a list of resolutions that won't be shown in the chart, e.g. hide_resolutions=invalid|duplicate, and have the default value be invalid|duplicate|worksforme|wontfix (i.e the "negative" resolutions for a default Trac install).

• ## 0.11/tracjsgantt/tracjsgantt.py

 # Make the query argument query_args['col'] = "|".join(fields) # Only show tickets with resolution None or Fixed resolutions = ['fixed', ''] query_args['resolution'] = "|".join(resolutions) # Construct the querystring. query_string = '&'.join(['%s=%s' % item for item in query_args.iteritems()])

### comment:3 Changed 6 years ago by anonymous

The initial patch was not working the way I thought it would. However, the following does work, and I'd clean it up a bit before committing a real patch.

• ## 0.11/tracjsgantt/tracjsgantt.py

 # Construct the querystring. query_string = '&'.join(['%s=%s' % item for item in query_args.iteritems()]) # Only show tickets with resolution None or Closed hide_resolutions = ['duplicate', 'invalid', 'wontfix', 'worksforme'] query_string = query_string + '&resolution!=' + '|'.join(hide_resolutions) # Get the Query Object. query = Query.from_string(self.env, query_string)

### comment:4 Changed 6 years ago by falkb

this ticket is a good idea

### comment:5 follow-up:  6 Changed 6 years ago by Odd Simon Simonsen

You'd really want to provide these through config options... Just because these resolutions are created as default Trac data there is no guarantee that any of them will exist in installations - or that they are the only resolutions to consider. None of them carry any special meaning in Trac, and may be changed or localized by admins any time.

### comment:6 in reply to:  5 Changed 6 years ago by Ryan J Ollos

You'd really want to provide these through config options...

Thanks, I will definitely do that for the final patch. I was just hacking around here to see what would work.

It seems like we'd probably want to provide the default behavior for an install through the config option, and also allow a macro parameter that can be used to override the default when calling the macro.

Btw, I was hoping to find some time in the near future to copy the example you provided for the TagsPlugin and get some unit tests running for this plugin. I feel somewhat guilty departing from my good coding habits when I leave my real job in C++/matlab to hack on Trac in Python, both of which I know very little about.

### comment:7 follow-up:  8 Changed 6 years ago by Chris Nelson

I see the utility of this feature. I've actually been bothered by cancelled tickets cluttering my charts before. I think it needs two thingss:

• A way to configure negative resolutions
• A chart option to heed or ignore that configuration (maybe showCancelled which defaults to false).

### comment:8 in reply to:  7 ; follow-up:  9 Changed 6 years ago by falkb

• A way to configure negative resolutions

I'd like it if it was a string with a common ticket query, for example "status=!duplicate&myowncustomticketfield=certainvalue". This would allow maximum configurability, especially concerning custom fields.

### comment:9 in reply to:  8 ; follow-up:  10 Changed 6 years ago by Chris Nelson

• A way to configure negative resolutions

I'd like it if it was a string with a common ticket query, for example "status=!duplicate&myowncustomticketfield=certainvalue". This would allow maximum configurability, especially concerning custom fields.

Doesn't that work now? I admit my understanding of the query engine is a little weak but if you can do [[TicketQuery(status=!duplicate&myowncustomticketfield=certainvalue)]], then you can do the same with the Gantt; anything without a special Gantt-specific meaning, just gets passed on.

### comment:10 in reply to:  9 ; follow-ups:  11  12 Changed 6 years ago by falkb

Doesn't that work now? I admit my understanding of the query engine is a little weak but if you can do [[TicketQuery(status=!duplicate&myowncustomticketfield=certainvalue)]], then you can do the same with the Gantt; anything without a special Gantt-specific meaning, just gets passed on.

Not sure what you mean.

But it sounds like invalid|wontfix|worksforme)? is the solution to close this ticket 9442 as 'worksforme', doesn't it?

### comment:11 in reply to:  10 Changed 6 years ago by falkb

Oops... I mean  [[TracJSGanttChart(milestone=Foo,userMap=0,format=week,resolution!=duplicate|invalid|wontfix|worksforme)]]

### comment:12 in reply to:  10 ; follow-ups:  13  14 Changed 6 years ago by Chris Nelson

Doesn't that work now? I admit my understanding of the query engine is a little weak but if you can do [[TicketQuery(status=!duplicate&myowncustomticketfield=certainvalue)]], then you can do the same with the Gantt; anything without a special Gantt-specific meaning, just gets passed on.

Not sure what you mean.

But it sounds like invalid|wontfix|worksforme)? is the solution to close this ticket 9442 as 'worksforme', doesn't it?

That should work but you have to do that in every chart instance. If there were a chart option, you could configure a site default that did it for you. I think it's useful enough that I'll incorporate a patch if Ryan comes up with one but not so useful that I'm going to find time to do it myself.

### comment:13 in reply to:  12 Changed 6 years ago by Ryan J Ollos

I think it's useful enough that I'll incorporate a patch if Ryan comes up with one but not so useful that I'm going to find time to do it myself.

I'll be providing a patch for this in the near future.

### comment:14 in reply to:  12 Changed 6 years ago by falkb

That should work but you have to do that in every chart instance. If there were a chart option, you could configure a site default that did it for you.

I see - you mean a trac.ini setting. Then, I suggest this for maximum configurability:

[trac-jsgantt]
ticket_filter_condition = resolution!=duplicate|invalid|wontfix|worksforme


### comment:15 Changed 6 years ago by falkb

it means one can set any useful additional query condition that will be added to the internal query_string

### Modify Ticket

Change Properties