wiki:ValuePropagationPlugin

Version 4 (modified by ChrisNelson, 4 years ago) (diff)

Link to download section

Value Propagation Plugin

Description

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

Bugs/Feature Requests

Existing bugs and feature requests for ValuePropagationPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out ValuePropagationPlugin from here using Subversion, or browse the source with Trac.

Installation

  1. Download the source and run:
    python setup.py bdist_egg
    
  1. Install it in one of the following ways:
    cp dist/*.egg path/to/trac/env/plugins
    
    easy_install dist/*.egg
    
  1. Enable the plugin in trac.ini as follows:
    [components]
    valuepropagation.* = enabled
    

Example

[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

Recent Changes

[14019] by rjollos on 2014-07-23 21:36:26
Removed empty directory.
[14018] by rjollos on 2014-07-23 21:35:26
Removed empty directory.
[14012] by rjollos on 2014-07-23 21:27:42
Changed license to 3-Clause BSD with permission of author. Refs #11871.

Author/Contributors

Author: ChrisNelson
Maintainer: ChrisNelson
Contributors: