CC-4661: Listener Statistics
-factor out mountname into it's own table
This commit is contained in:
parent
080c3ec944
commit
4218a7f30d
|
@ -7,13 +7,15 @@ class Application_Model_ListenerStat
|
||||||
|
|
||||||
public static function getDataPointsWithinRange($p_start, $p_end) {
|
public static function getDataPointsWithinRange($p_start, $p_end) {
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT cc_listener_count.ID, cc_timestamp.TIMESTAMP, cc_listener_count.LISTENER_COUNT, mount_name
|
SELECT lc.id, ts.timestamp, lc.listener_count, mn.mount_name
|
||||||
FROM cc_listener_count
|
FROM cc_listener_count AS lc
|
||||||
INNER JOIN cc_timestamp ON (cc_listener_count.TIMESTAMP_ID=cc_timestamp.ID)
|
INNER JOIN cc_timestamp AS ts ON (lc.timestamp_id = ts.ID)
|
||||||
WHERE (cc_timestamp.TIMESTAMP>=:p1 AND cc_timestamp.TIMESTAMP<=:p2)
|
INNER JOIN cc_mount_name AS mn ON (lc.mount_name_id = mn.ID)
|
||||||
ORDER BY cc_listener_count.mount_name, cc_timestamp.TIMESTAMP
|
WHERE (ts.timestamp >=:p1 AND ts.timestamp <= :p2)
|
||||||
|
ORDER BY mount_name, timestamp
|
||||||
SQL;
|
SQL;
|
||||||
$data = Application_Common_Database::prepareAndExecute($sql, array('p1'=>$p_start, 'p2'=>$p_end));
|
$data = Application_Common_Database::prepareAndExecute($sql,
|
||||||
|
array('p1'=>$p_start, 'p2'=>$p_end));
|
||||||
|
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach ($data as $d) {
|
foreach ($data as $d) {
|
||||||
|
@ -26,7 +28,7 @@ SQL;
|
||||||
public static function getAllMPNames() {
|
public static function getAllMPNames() {
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT DISTINCT mount_name
|
SELECT DISTINCT mount_name
|
||||||
FROM cc_listener_count
|
FROM cc_listener_count
|
||||||
SQL;
|
SQL;
|
||||||
$mps = Application_Common_Database::prepareAndExecute($sql, array());
|
$mps = Application_Common_Database::prepareAndExecute($sql, array());
|
||||||
$out = array();
|
$out = array();
|
||||||
|
|
Loading…
Reference in New Issue