Implementing an almost realtime status box

Hi,

I’ve been asked to check out how hard it would be to implement functionality
to RT 3.2 (3.2.2 now) giving managers a quick overview on what’s happening
to tickets. Ideally this should just be another box below Quick ticket
creation on RT’s home page. It could look like this:

Wed Oct 06 00:16:54 2004 (#25000) user - Status changed from new to resolved

Mon Sep 20 11:26:40 2004 (#22222) user - Queue changed from q1 to q2

Sun Sep 19 01:41:13 2004 (#12345) user - Priority changed from 0 to 70

Sun Sep 19 00:16:47 2004 (#12345) user - Status changed from new to open

Having looked through the schema and Display.html it seems like I should
get a list of the 10 most recently updated tickets using Tickets.LastUpdated,
sort the results descending. Then, for each and every ticket returned, I
should get the list of transactions and in descending order using
Transactions.Created take N (thinking 1-3) print them out to something that
resembles the example above.

Has anyone implemented anything like this before? Would this be useful for
anyone else? I guess I should somehow attempt to translate the above to
existing function calls in the RT api, any pointers?

Thanks. :slight_smile:

// kaj

Kaj J.Niemi wrote:

Hi,

I’ve been asked to check out how hard it would be to implement functionality
to RT 3.2 (3.2.2 now) giving managers a quick overview on what’s happening
to tickets. Ideally this should just be another box below Quick ticket
creation on RT’s home page. It could look like this:

Wed Oct 06 00:16:54 2004 (#25000) user - Status changed from new to resolved

Mon Sep 20 11:26:40 2004 (#22222) user - Queue changed from q1 to q2

Sun Sep 19 01:41:13 2004 (#12345) user - Priority changed from 0 to 70

Sun Sep 19 00:16:47 2004 (#12345) user - Status changed from new to open

Having looked through the schema and Display.html it seems like I should
get a list of the 10 most recently updated tickets using Tickets.LastUpdated,
sort the results descending. Then, for each and every ticket returned, I
should get the list of transactions and in descending order using
Transactions.Created take N (thinking 1-3) print them out to something that
resembles the example above.
I think you should start not from Tickets, but from Transactions and
order them by Created time and id. From each transaction you can get its
ticket.

Has anyone implemented anything like this before? Would this be useful for
anyone else? I guess I should somehow attempt to translate the above to
existing function calls in the RT api, any pointers?
Look on history page and investigate how RT get short description for
transactions.

I think you should start not from Tickets, but from Transactions
and order them by Created time and id.

Yes, this approach was simpler and easier once I figured out how to get
the list of transactions without going through a specific ticket first.

It’s #6169 if you want to take a look at it.

// kaj

  1. You should use multiple fields to order, one field is not enough.
    Example: user resolve ticket and add comment: two transactons has same
    value of ‘Created’ in most cases cause datetime field doesn’t store
    subseconds.

  2. it’s save to do
    while( my $transaction = $Transactions->Next ) {

    }
    instead of if($transaction) { do {} …

  3. Transaction inherit rights from its Ticket mostly then you can do
    $Transaction->CurrentUserHasRight(‘Right’) check.

  4. Check rights before callback it would be faster.

  5. that’s all what I see

     	Best regards. Ruslan.
    

Kaj J.Niemi wrote:

  1. You should use multiple fields to order, one field is not enough.
  2. it’s save to do while( my $transaction = $Transactions->Next )
  3. Transaction inherit rights from its Ticket
  4. Check rights before callback it would be faster.

Ok, fixed all of these. I sent a newer version to #6169. Thanks for your
input. :slight_smile:

// kaj