Hi, i have a routine that calculates average time per ticket. It seems if the ticket is handled rather quickly i get a warning that says.
PHP Warning: Division by zero in /include/staff/staff.inc.php on line 178
<tr><th>Average Time per Ticket</th>
<td class="mainTableAlt">
<?php
$avg_time_per_ticket = round($total_time / $total_tick);
$avg_time_per_ticket_format = Ticket:($avg_time_per_ticket);
echo $avg_time_per_ticket_format;
?>
</td>
Should i set $total_time to a min value, maybe 1 sec to overcome this warning? Whats the best way?
UPDATE:
did some other testing and it does seem to work fine. What was happening is that i have dif departments and i was assigning tickets to staff in those departments thru admin login, admin login does not add time to ticket when i post reply or assign to staff by admin so after assignment the ticket is still sitting at
Total Time Spent
0 Day(s), 0 Hour(s), 0 Minute(s), 0 Second(s).
now if i went in and decided the ticket was bogus (in admin) and deleted the ticket then it gives that warning.
If the staff member replys and does anything with the ticket, then it calculates time and then it changes to this
Total Time Spent
0 Day(s), 0 Hour(s), 2 Minute(s), 24 Second(s).
Then if i delete the ticket it does not give that warning.
So i guess the solution is two fold, first if assigned to staff by admin add some time to the ticket so that it is not 0 time. Or just make sure that the staff member puts at least one reply minimum to the ticket no matter what so that avoids that warning.