[rt-devel] Due Dates

Thomas Koester tkoester at intevation.de
Wed Jan 17 12:09:25 EST 2001


On Tue, Jan 16, 2001 at 10:14:31AM -0500, Brandon S. Allbery KF8NH wrote:
> Date: Mon, 30 Oct 2000 04:36:53 +0100
> From: =?ISO-8859-1?Q?Ren=E9?= Seindal <rene at seindal.dk>
> 
> 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
> ---------------------------------------------------------------------------

Good idea. I've modified this a little bit:

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


Now the priority will be set to the final_priority even if the
script is run a few minutes after date_due.

Thomas

-- 
Email: tkoester at intevation.de
http://intevation.de/~tkoester/




More information about the Rt-devel mailing list