The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Response Time
I am trying to get this to properly give the average response time for tickets. Similar to what is on vb.com but for the life of me it won't work. Gives me -34613 hours and -14 mins, very annoying.
Here is the function: PHP Code:
PHP Code:
HTML Code:
$hour:$minute Thanks Steve |
#2
|
|||
|
|||
What are the types in the database of pl9_support_tickets.tadded and pl9_support_replies.radded? Are they strings of the correct format? I'm thinking maybe they could already be numbers. You could easily look at this (if you haven't already) by building up a string then throwing it in the template somewhere (as an html comment maybe).
Also I don't think you want "round" on the hour calculation, I think you want to use floor() or else make sure you are dividing two integer values. |
#3
|
|||
|
|||
kh99 is right; round is the wrong function to use:
http://uk3.php.net/manual/en/function.round.php round() will round 3.5 UP to 4. I think the logic of your function is off slightly as well, but I'm unable to figure out where. |
#4
|
|||
|
|||
tadded and radded is unix time inserted into the database when a ticket is added or a reply is added. So round() is possibly causing the problem? So far any thing I found that deals with giving an average uses round.
|
#5
|
|||
|
|||
Quote:
Quote:
hrs = 6300 / 3600 = 1.75, rounded up = 2 hrs, but floor(1.75) = 1 |
#6
|
|||
|
|||
Ok so using my code above, any suggestion of a way to rewrite. I've stated this before but I learn best from example codes then discussion of various means. I understand what your saying but implementing is my problem. LOL
|
#7
|
|||
|
|||
Well assuming I'm right about those time fields (and I'm not sure), I would say change these two lines to:
Code:
$rep = $query['radded']; $tick = $res['tadded']; Also, change this line to Code:
$hour = floor($avg/3600); |
#8
|
|||
|
|||
Yeah they both are INT type, I believe they are unsigned. So this is what I should have:
PHP Code:
--------------- Added [DATE]1265060826[/DATE] at [TIME]1265060826[/TIME] --------------- Ok I tested the code, result was the following: Code:
-175695:10 |
#9
|
|||
|
|||
ok, well if anyone else has an idea, feel free to jump in....
meanwhile, if it were me i'd find a way to display the values and see where they don't look right, like maybe.... PHP Code:
Then put $debug_tickets in the template somewhere. |
#10
|
|||
|
|||
Ok I had to take it out of a function and make it a straight query just to get an output. Here is the output of the $debug_tickets:
Code:
tid=2 tadded=1265002705 radded= seconds=-1265002705 i=1 tid=1 tadded=1264641238 radded=1264641238 seconds=-1265002705 i=2 --------------- Added [DATE]1265079985[/DATE] at [TIME]1265079985[/TIME] --------------- BTW, the first line of tid=2, radded= is blank because no reply has been added to that ticket. --------------- Added [DATE]1265080418[/DATE] at [TIME]1265080418[/TIME] --------------- Reversed $seconds += ($rep - $tick) to ($tick - $rep) which gives me the following: Code:
tid=2 tadded=1265002705 radded= seconds=1265002705 i=1 tid=1 tadded=1264641238 radded=1264641238 seconds=1265002705 i=2 Code:
175694:49 Added a reply to the tid=2 and this is the new output: Code:
tid=2 tadded=1265002705 radded=1265084927 seconds=-82222 i=1 tid=1 tadded=1264641238 radded=1264641238 seconds=-82222 i=2 -12:34 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|