Rewrite algorithm to identify tickets to reschedule.  Refs #9648.
Rewrite algorithm to identify tickets to reschedule.  Refs #9648.

This is a shorter, cleaner algorithm:

 * Find what's active now
 * Find what was active
 * wasActive - isActive should be idled
 * isActive should be rescheduled
  * Save only if schedule changes

It also works. ;-) With the old algorithm if you has two goals scheduled
and interrupted the earlier one, the tasks for the second goal weren't
moved up.  The code to find active and idled tickets was weak and
fragile and not worth fixing since it was also slow.  In general, this
new approach handles a lot less data, defers getting ticket details as
long as possible, and gets them for many fewer tickets.  In my
playground, I used to query 150 tickets (basically, everything in the
database) and now I query 4-5 tickets (the active set).  I expect that
ratio to scale to production.  Since querying for ticket details was the
longest part of rescheduling, this is much, much faster than the old
approach.

git-svn-id: 2159781fc7c14c6bdd1f7e265daf7a25099c31e7@13839 7322e99d-02ea-0310-aa39-e9a107903beb

trac-hacks/trac-jsGantt,trac-hacks/trac-jsGantt,trac-hacks/trac-jsGantt