|Version 6 (modified by ChrisNelson, 6 years ago) (diff)|
Value Propagation Plugin
A configurable ticket change listener plugin that can update other fields or fields on other tickets when a ticket changes. This is a fairly rough first draft. It handles ticket changes fairly well, doesn't blow up on ticket creation and doesn't do anything on ticket deletion. Looking for feedback.
Update values in other tickets based on ticket changes. For example, with Subtickets plugin and Timing and Estimation plugin in place, a parent ticket's estimate may be the sum of its children's estimates. This plugin can update the parent when the child changes.
There are three types of relationships:
- self - the "other" ticket is the current ticket (update another field)
- link - the other tickets are listed in a field of this ticket
- query - the other tickets can be queried based on this ticket's ID
There are several methods of updating the other ticket's value:
- sum - add this ticket's value to the other ticket's value. (This ticket's old value is subtracted first.) Essentially:
oldOther[to] -= old_values[from] newOther[to] += ticket[from]
- min - the other ticket's value is the minimum of it's old value and this ticket's value
- max - the other ticket's value is the maximum of it's old value and this ticket's value
- suffix - this ticket's value is added as a suffix to the other ticket's value. (This ticket's old value is removed first.)
- prefix - this ticket's value is added as a prefix to the other ticket's value. (This ticket's old value is removed first.)
Other desirable methods which are not yet implemented:
- union: like sum but field f is a list (set)
- set: other's f2 is ticket's f1.
When the enum priority changes, the pseudo-field "priority_value" is available for processing.
Configuration looks something like:
[value_propagation] r1.type = link r1.link = parents r1.fields = estimatedhours, hours r1.method.estimatedhours = sum r1.method.hours = sum r2.type = query r2.query = SELECT child FROM subtickets WHERE parent = %s r2.fields = effpriority r2.method.effpriority = prefix r3.type = self r3.fields = priority:effpriority r3.method.priority = suffix
If you have any issues, create a new ticket.
Download the zipped source from [download:valuepropagationplugin here].
- Download the source and run:
python setup.py bdist_egg
- Install it in one of the following ways:
cp dist/*.egg path/to/trac/env/plugins
- Enable the plugin in trac.ini as follows:
[components] valuepropagation.* = enabled
[value_propagation] # Update based on a field in the ticket r1.type = link # Find other ticket IDs in "parents" field (from Subtickets) r1.link = parents # Update estimatedhours and hour (from Timing and Estimation) r1.fields = estimatedhours, hours # Both fields roll up to parent by summing child values. r1.method.estimatedhours = sum r1.method.hours = sum