CC-3993: Validate that reporting stats are correct on Airtime PRO instances
-done -if no log data for the past 24 hours, update current record with current date, and delete old records
This commit is contained in:
parent
27a6326c58
commit
9ac024fa72
|
@ -20,12 +20,30 @@ class Application_Model_LiveLog
|
||||||
if ($rows != null) {
|
if ($rows != null) {
|
||||||
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
||||||
array_push($rows, $last_row);
|
array_push($rows, $last_row);
|
||||||
|
$skip = false;
|
||||||
|
} else {
|
||||||
|
$sql = "SELECT * FROM CC_LIVE_LOG"
|
||||||
|
." WHERE state = 'L'"
|
||||||
|
." ORDER BY id";
|
||||||
|
$rows = $con->query($sql)->fetchAll();
|
||||||
|
|
||||||
|
if ($rows != null) {
|
||||||
|
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
||||||
|
array_push($rows, $last_row);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$sql_delete = "DELETE FROM CC_LIVE_LOG"
|
||||||
|
." WHERE id = '{$row['id']}'";
|
||||||
|
$con->exec($sql_delete);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$skip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hours = 0;
|
$hours = 0;
|
||||||
$minutes = 0;
|
$minutes = 0;
|
||||||
$seconds = 0;
|
$seconds = 0;
|
||||||
|
|
||||||
|
if (!$skip) {
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$end = new DateTime($row['end_time']);
|
$end = new DateTime($row['end_time']);
|
||||||
$start = new DateTime($row['start_time']);
|
$start = new DateTime($row['start_time']);
|
||||||
|
@ -73,6 +91,7 @@ class Application_Model_LiveLog
|
||||||
else {
|
else {
|
||||||
$minutes = (double)(($hours*60)+$minutes);
|
$minutes = (double)(($hours*60)+$minutes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $minutes;
|
return $minutes;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
header('HTTP/1.0 503 Service Unavailable');
|
header('HTTP/1.0 503 Service Unavailable');
|
||||||
|
@ -99,12 +118,31 @@ class Application_Model_LiveLog
|
||||||
if ($rows != null) {
|
if ($rows != null) {
|
||||||
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
||||||
array_push($rows, $last_row);
|
array_push($rows, $last_row);
|
||||||
|
$skip = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql = "SELECT * FROM CC_LIVE_LOG"
|
||||||
|
." WHERE state = 'S'"
|
||||||
|
." ORDER BY id";
|
||||||
|
$rows = $con->query($sql)->fetchAll();
|
||||||
|
|
||||||
|
if ($rows != null) {
|
||||||
|
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
||||||
|
array_push($rows, $last_row);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$sql_delete = "DELETE FROM CC_LIVE_LOG"
|
||||||
|
." WHERE id = '{$row['id']}'";
|
||||||
|
$con->exec($sql_delete);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$skip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hours = 0;
|
$hours = 0;
|
||||||
$minutes = 0;
|
$minutes = 0;
|
||||||
$seconds = 0;
|
$seconds = 0;
|
||||||
|
|
||||||
|
if (!$skip) {
|
||||||
/* Get all shows and tracks from cc_schedule that played
|
/* Get all shows and tracks from cc_schedule that played
|
||||||
* during a scheduled state
|
* during a scheduled state
|
||||||
*/
|
*/
|
||||||
|
@ -215,6 +253,7 @@ class Application_Model_LiveLog
|
||||||
else {
|
else {
|
||||||
$minutes = (double)(($hours*60)+$minutes);
|
$minutes = (double)(($hours*60)+$minutes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $minutes;
|
return $minutes;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
header('HTTP/1.0 503 Service Unavailable');
|
header('HTTP/1.0 503 Service Unavailable');
|
||||||
|
|
Loading…
Reference in New Issue