graph date filter
[scannr.git] / calls.json.php
blob:a/calls.json.php -> blob:b/calls.json.php
--- a/calls.json.php
+++ b/calls.json.php
@@ -3,10 +3,10 @@
 function getTGIDValuesByHour($TGID, $timeFrom, $timeTo) {
     global $conn;
     $sth = $conn->prepare( 'select tgid, min(call_timestamp) as time, count(*), min(length), max(length), avg(length), stddev(length) from recordings
+where call_timestamp between to_timestamp(?) and to_timestamp(?)
             group by tgid, date_trunc(\'hour\', call_timestamp) order by time');
 
-    $sth->execute( );
-    //Array($TGID, $timeFrom, $timeTo)
+    $sth->execute(Array($timeFrom, $timeTo));
         return  $sth->fetchAll();