[Rt-devel] RT::Action::EscalatePriority

Curtis Bruneau curtisb at vianet.ca
Thu Aug 6 16:51:42 EDT 2009

I've found the math to be a little off, at least for my use. It will max 
priority anything within 47.9~ hours of the due date. The int() rounding 
is somewhat the culprit plus dividing by 1 will always go max priority. 
I've used this for my use where it will only max out if the current time 
is a second or more passed due. ceil will make diff_in_days always count 
a full day for any second over a full day. You can take out 
$diff_in_days + 1 if you want it to max if it's within a day in seconds. 
This isn't a change proposal more like personal thing, perhaps within a 
day or over logic could be configurable, although the original int 
rounding does make it off a bit.

<       use POSIX qw(ceil);
<       my $diff_in_days = ceil( $diff_in_seconds / 86400);
 >       my $diff_in_days = int( $diff_in_seconds / 86400);
<           my $inc_priority_by = int( $prio_delta / ( $diff_in_days + 1));
 >           my $inc_priority_by = int( $prio_delta / $diff_in_days );

More information about the Rt-devel mailing list