wiki:ValuePropagationPlugin

Version 9 (modified by Ryan J Ollos, 7 years ago) (diff)

Revise install instructions.

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.

Update values in other tickets based on ticket changes. For example, with SubticketsPlugin and TimingAndEstimationPlugin 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 its old value and this ticket's value
  • max - the other ticket's value is the maximum of its 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

Bugs/Feature Requests

Existing bugs and feature requests for ValuePropagationPlugin are here.

If you have any issues, create a new ticket.

defect

3 / 3

Download

Download the zipped source from here.

Source

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

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

Enable the plugin in your trac.ini file:

[components]
valuepropagation.* = enabled

Configuration

[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

16190 by rjollos on 2017-01-20 07:49:25
1.2.0dev: Adapt to Trac 1.2 API

  • Fix variable referenced before assigned, fixes #12084
  • Fix attribute error due to int cnum, fixes #11033

Fixes #13038.

16189 by rjollos on 2017-01-20 06:02:09
1.2.0dev: Conform to PEP8
16188 by rjollos on 2017-01-20 05:48:11
Branch for Trac 1.2 support
(more)

Author/Contributors

Author: ChrisNelson
Maintainer: Chris Nelson
Contributors: