Opened 3 years ago

Last modified 3 years ago

## #9165 new enhancement

# Allow estimation_field to be set as Macro attribute

Reported by: | asyn | Owned by: | hoessler |
---|---|---|---|

Priority: | normal | Component: | EstimationToolsPlugin |

Severity: | normal | Keywords: | |

Cc: | rjollos | Trac Release: | 0.12 |

### Description

Some developers using the agile approach would like to use more than one burndown chart.

It makes for example sense to have one burndown chart showing »remaining hours« and one showing »not finished story points«.

What do you think about allowing the calculation-field to be passed in as macro parameter?

Example:

[[BurndownChart(title=Burndown Chart, milestone=Beta 2, startdate=2011-09-07, estimation_field=storypoints)]]

Would create a chart based on the field storypoints.

When not specified it should use the field from trac.ini.

I achieved this behaviour by adding this snippet to the macro functions:

estimation_field = self.estimation_field if (options['estimation_field'] != self.estimation_field): estimation_field = options['estimation_field']

Additionally I replaced every `self.estimation_field` with `estimation_field` in subsequent lines.

This is an example diff for the file trunk/estimationtools/burndownchart.py:

13c13 < 'bgcolor': 'ffffff00', 'wecolor':'ccccccaa', 'colorexpected': 'ffddaa', 'weekends':'true', 'gridlines' : '0'} --- > 'bgcolor': 'ffffff00', 'wecolor':'ccccccaa', 'colorexpected': 'ffddaa', 'weekends':'true', 'gridlines' : '0', 'estimation_field' : 'remaininghours'} 60a61,64 > > estimation_field = self.estimation_field > if (options['estimation_field'] != 'remaininghours'): > estimation_field = options['estimation_field'] 146a151,154 > estimation_field = self.estimation_field > if (options['estimation_field'] != 'remaininghours'): > estimation_field = options['estimation_field'] > 157c165 < query_args[self.estimation_field + "!"] = None --- > query_args[estimation_field + "!"] = None 169c177 < latest_estimate = self._cast_estimate(t[self.estimation_field]) --- > latest_estimate = self._cast_estimate(t[estimation_field]) 179c187 < "ORDER BY c.time ASC", [t['id'], self.estimation_field]) --- > "ORDER BY c.time ASC", [t['id'], estimation_field]) 195c203 < if row_field == self.estimation_field: --- > if row_field == estimation_field:

utils.py

21c21 < 'expected', 'colorexpected', 'title'] --- > 'expected', 'colorexpected', 'title', 'estimation_field']

My python knowledge is quite limited so please improve the code where necessary.

### Attachments (0)

**Note:**See TracTickets for help on using tickets.