|Version 2 (modified by ChrisNelson, 3 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.
FIXME - A system of pluggable types and methods would be nice.
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 r2.method.priority = suffix
If you have any issues, create a new ticket.
Download the zipped source from here.
-  by ChrisNelson on 2010-11-18 17:15:55
0.2 of the plugin.
- Pass options to methods in case they need additional configuration.
Filter the whole option list to those that apply to this
relationship. This is more useful -- but likely less efficient --
than passing the relationship name and letting the method get the
I'm not convinced my option filter is optimal.
- Add default handling to the suffix method.
With the previous change, the suffix method can now find a "default"
setting in configuration and go find a base value for ticket
creation. I don't (yet) see how this would help other existing
methods but it provides a richer environment for developing
additional methods and solves my problem with bootstrapping the
effective priority of children as they are created.
- Number the ticket comment for the value propagation properly and uniquely for reference and for ticket change and ticket deletion.
-  by ChrisNelson on 2010-11-01 20:43:07
Initial commit of 0.1 hack.
-  by ChrisNelson on 2010-11-01 20:11:11
New hack ValuePropagationPlugin, created by ChrisNelson