Modify

Opened 3 years ago

Last modified 3 years ago

#9442 new enhancement

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

Reported by: rjollos Owned by: ChrisNelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: falkb Trac Release: 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.

Attachments (0)

Change History (15)

comment:1 Changed 3 years ago by rjollos

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

     
    377377        # Make the query argument 
    378378        query_args['col'] = "|".join(fields)   
    379379 
     380        # Only show tickets with resolution None or Fixed 
     381        resolutions = ['fixed', ''] 
     382        query_args['resolution'] = "|".join(resolutions) 
     383 
    380384        # Construct the querystring.  
    381385        query_string = '&'.join(['%s=%s' %  
    382386                                 item for item in query_args.iteritems()])  

comment:3 Changed 3 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

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

comment:4 Changed 3 years ago by falkb

  • Cc falkb added

this ticket is a good idea

comment:5 follow-up: Changed 3 years ago by osimons

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 3 years ago by rjollos

Replying to osimons:

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: Changed 3 years ago by ChrisNelson

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: Changed 3 years ago by falkb

Replying to ChrisNelson:

  • 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: Changed 3 years ago by ChrisNelson

Replying to falkb:

Replying to ChrisNelson:

  • 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: Changed 3 years ago by falkb

Replying to ChrisNelson:

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 3 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: Changed 3 years ago by ChrisNelson

Replying to falkb:

Replying to ChrisNelson:

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 3 years ago by rjollos

Replying to ChrisNelson:

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 3 years ago by falkb

Replying to ChrisNelson:

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 3 years ago by falkb

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

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.