From: Alex Sadleir Date: Wed, 02 Jan 2013 00:05:15 +0000 Subject: select input X-Git-Url: http://maxious.lambdacomplex.org/git/?p=scannr.git&a=commitdiff&h=d45092073c216d17f214015064451a7ea949b2ba --- select input --- --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,18 @@ *.pyc /nbproject/private/ /output.txt + +bin +gen +target +.settings +.classpath +.project +*.keystore +*.swp +*.orig +*.log +*.properties +seed.txt +map.txt + --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,6 @@ - - - - @@ -13,55 +9,42 @@ - - - - - + - - - - - - - - - - - - + + + - + @@ -123,16 +106,43 @@ - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -158,10 +168,11 @@ @@ -169,7 +180,7 @@ @@ -197,6 +208,7 @@ + @@ -218,17 +230,16 @@ - - + + - + + + + + + + + + + + + @@ -280,21 +317,21 @@ - + - + - + @@ -364,92 +401,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + --- a/calls.json.php +++ b/calls.json.php @@ -8,7 +8,7 @@ group by tgid, date_trunc(\'hour\', call_timestamp) order by time'); $sth->execute(Array($timeFrom, $timeTo)); - return $sth->fetchAll(); + return $sth->fetchAll(PDO::FETCH_ASSOC); } @@ -20,7 +20,7 @@ group by sensor_id, date_trunc(\'day\', time) order by time'); $sth->execute(Array($TGID)); - return $sth->fetchAll(); + return $sth->fetchAll(PDO::FETCH_ASSOC); } function getTGIDDataYears($TGID, $timeFrom, $timeTo) { @@ -28,7 +28,7 @@ $sth = $conn->prepare("select distinct extract('year' from call_timestamp) as year from recordings where tgid = ? order by year"); $sth->execute(Array($TGID)); - return $sth->fetchAll(); + return $sth->fetchAll(PDO::FETCH_ASSOC); } function getTGIDDataMonths($TGID, $timeFrom, $timeTo) @@ -37,7 +37,7 @@ $sth = $conn->prepare("select distinct extract('month' from call_timestamp) as month, extract('year' from call_timestamp) as year from recordings where tgid = ? order by year, month"); $sth->execute(Array($TGID)); - return $sth->fetchAll(); + return $sth->fetchAll(PDO::FETCH_ASSOC); } function getTGIDDataDays($TGID, $timeFrom, $timeTo) @@ -47,13 +47,21 @@ $sth->execute(Array($TGID)); - return $sth->fetchAll(); + return $sth->fetchAll(PDO::FETCH_ASSOC); } $action = (isset($_REQUEST['action']) ? $_REQUEST['action'] : ''); $TGID = (isset($_REQUEST['tgid']) ? $_REQUEST['tgid'] : ''); $timefrom = (isset($_REQUEST['from']) ? $_REQUEST['from'] : ''); $timeto = (isset($_REQUEST['to']) ? $_REQUEST['to'] : ''); +if ($action == "data") { +$sth = $conn->prepare('select * from recordings + order by call_timestamp desc limit 100'); + +$sth->execute(Array()); + +echo json_encode ($sth->fetchAll(PDO::FETCH_ASSOC)); +} if ($action == "data_description") { $timefrom = strtotime($timefrom); $timeto = strtotime($timeto); --- a/generateConvos.php +++ b/generateConvos.php @@ -1,4 +1,5 @@ prepare('select * from recordings limit 100;'); --- /dev/null +++ b/generateHourlys.php @@ -1,1 +1,33 @@ +&1'; + //print_r($hourly); + exec ( $cmd,$output,$returncode ); + echo $cmd."
\n"; + if ($returncode != 10) { + //print_r($output); + //die(); + } + } +} +$sth = $conn->prepare("select tgid, extract(hour from call_timestamp) ahour, date_trunc('day', call_timestamp) aday, count(filename), array_to_string(array_agg(filename order by call_timestamp), ',') filenames from recordings group by tgid, ahour, aday order by aday DESC, ahour, tgid;"); + +$sth->execute(); +$hourlies = $sth->fetchAll(PDO::FETCH_ASSOC); +foreach($hourlies as $hourly) { + //processHourly($hourly); +} +$sth = $conn->prepare("select 'hour' as tgid, extract(hour from call_timestamp) ahour, date_trunc('day', call_timestamp) aday, count(filename), array_to_string(array_agg(filename order by call_timestamp), ',') filenames from recordings group by ahour, aday order by aday DESC, ahour;"); + +$sth->execute(); +$hourlies = $sth->fetchAll(PDO::FETCH_ASSOC); +foreach($hourlies as $hourly) { + processHourly($hourly); +} + --- /dev/null +++ b/scannrmobile/.gitignore @@ -1,1 +1,14 @@ +bin +gen +target +.settings +.classpath +.project +*.keystore +*.swp +*.orig +*.log +*.properties +seed.txt +map.txt --- /dev/null +++ b/scannrmobile/.idea/.name @@ -1,1 +1,1 @@ - +scannrmobile --- /dev/null +++ b/scannrmobile/.idea/ant.xml @@ -1,1 +1,8 @@ + + + + + + + --- /dev/null +++ b/scannrmobile/.idea/compiler.xml @@ -1,1 +1,27 @@ + + + + + + --- /dev/null +++ b/scannrmobile/.idea/copyright/profiles_settings.xml @@ -1,1 +1,5 @@ - + + + + + --- /dev/null +++ b/scannrmobile/.idea/encodings.xml @@ -1,1 +1,6 @@ + + + + + --- /dev/null +++ b/scannrmobile/.idea/misc.xml @@ -1,1 +1,11 @@ + + + + + + + + + + --- /dev/null +++ b/scannrmobile/.idea/modules.xml @@ -1,1 +1,10 @@ + + + + + + + + + --- /dev/null +++ b/scannrmobile/.idea/scopes/scope_settings.xml @@ -1,1 +1,5 @@ - + + + + --- /dev/null +++ b/scannrmobile/.idea/uiDesigner.xml @@ -1,1 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --- /dev/null +++ b/scannrmobile/.idea/vcs.xml @@ -1,1 +1,8 @@ + + + + + + + --- /dev/null +++ b/scannrmobile/.idea/workspace.xml @@ -1,1 +1,778 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +