Adjusting priorities


#1

Dear RT-users,

This little script will adjust the priority of all open and non overdue
tickets towards the final priority. The change is linear so each tickets
priority moves from the initial priority towards the final priority at a
constant speed. A tickets priority will only be changed upwards, so a ticket
that has had its priority raised won’t have it lowered automatically. The
opposite is not true, so a ticket that has been given a lower priority will
have it raised again.

This script will have no effect on tickets that are not open or stalled,
tickets without a due date, and tickets where the final priority is equal to
the initial priority.

#!/bin/sh
mysql rt <<EOF
update each_req set priority=greatest(priority,
round((final_priority-initial_priority)/(date_due-date_created)
*(unix_timestamp()-date_created) +initial_priority))
where date_due > unix_timestamp()
and status in (‘open’,‘stalled’);
EOF

René Seindal (rene@seindal.dk) http://www.seindal.dk/rene/