Added more logging, and info on show length to stats
This commit is contained in:
@@ -116,10 +116,10 @@ else {
|
|||||||
|
|
||||||
$provided_notes = urldecode( $decoded_json["notes"] );
|
$provided_notes = urldecode( $decoded_json["notes"] );
|
||||||
|
|
||||||
if ( empty($provided_notes) or strlen($provided_notes) > 100000 ) {
|
if ( empty($provided_notes) ) {
|
||||||
problem("Notes are missing not less than max");
|
problem("Notes are missing ");
|
||||||
}
|
}
|
||||||
logextra( "Notes are present and are under the max length" );
|
logextra( "Notes are present " );
|
||||||
|
|
||||||
$notes = $provided_notes;
|
$notes = $provided_notes;
|
||||||
|
|
||||||
@@ -531,9 +531,7 @@ if ( strcmp( $host_license, $db_license ) !== 0 ) {
|
|||||||
logextra( "Updating the host license" );
|
logextra( "Updating the host license" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
logextra( "The host_license is the same to that in the db \"$host_license\"" );
|
||||||
logextra( "The host_license is the same to that in the db \"$host_license\"" );
|
|
||||||
}
|
|
||||||
|
|
||||||
$title = mysqli_real_escape_string( $connection, $title );
|
$title = mysqli_real_escape_string( $connection, $title );
|
||||||
$summary = mysqli_real_escape_string( $connection, $summary );
|
$summary = mysqli_real_escape_string( $connection, $summary );
|
||||||
@@ -541,10 +539,15 @@ $notes = mysqli_real_escape_string( $connection, $notes );
|
|||||||
$tags = mysqli_real_escape_string( $connection, $tags );
|
$tags = mysqli_real_escape_string( $connection, $tags );
|
||||||
|
|
||||||
$query_add = "INSERT INTO eps VALUES ('$ep_num', '{$ep_date}', '{$title}', '{$duration}', '{$summary}', '{$notes}', '{$host_id}', '{$series_id}', '{$explicit}', '{$episode_license}', '{$tags}', '0', '0', '0')";
|
$query_add = "INSERT INTO eps VALUES ('$ep_num', '{$ep_date}', '{$title}', '{$duration}', '{$summary}', '{$notes}', '{$host_id}', '{$series_id}', '{$explicit}', '{$episode_license}', '{$tags}', '0', '0', '0')";
|
||||||
|
|
||||||
|
logextra( "About to add to db" );
|
||||||
|
|
||||||
$result = mysqli_query($connection, $query_add );
|
$result = mysqli_query($connection, $query_add );
|
||||||
if(!$result) {
|
if(!$result) {
|
||||||
problem("DB problem - The show $ep_num was not added to the eps db.");
|
problem("DB problem - The show $ep_num was not added to the eps db.");
|
||||||
}
|
}
|
||||||
|
logextra( "Response from db \"$result\"" );
|
||||||
|
|
||||||
if (mysqli_errno( $connection )) {
|
if (mysqli_errno( $connection )) {
|
||||||
$error = "MySQL error ".mysqli_errno( $connection ).": ".mysqli_error()."\n";
|
$error = "MySQL error ".mysqli_errno( $connection ).": ".mysqli_error()."\n";
|
||||||
problem("MySQL error- The show $ep_num was not added to the eps db.\n$error");
|
problem("MySQL error- The show $ep_num was not added to the eps db.\n$error");
|
||||||
|
|||||||
@@ -51,6 +51,35 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
|||||||
|
|
||||||
$next_free_slot = "https://repo.anhonesthost.net/HPR/hpr_hub/issues/71";
|
$next_free_slot = "https://repo.anhonesthost.net/HPR/hpr_hub/issues/71";
|
||||||
|
|
||||||
|
// --------------------------------------------
|
||||||
|
// Get the Shortest Show
|
||||||
|
|
||||||
|
$ep_retrieve = "SELECT id, duration FROM eps WHERE duration = ( SELECT MIN(duration) FROM eps WHERE duration > 0 AND id != 903)";
|
||||||
|
if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||||
|
$data=mysqli_fetch_assoc($result);
|
||||||
|
$min_duration_seconds = intval( $data['duration'] );
|
||||||
|
$min_duration_episode_number = intval( $data['id'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------
|
||||||
|
// Get the Longest Show
|
||||||
|
|
||||||
|
$ep_retrieve = "SELECT id, duration FROM eps WHERE duration = ( SELECT MAX(duration) FROM eps WHERE duration > 0 AND id != 903)";
|
||||||
|
if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||||
|
$data=mysqli_fetch_assoc($result);
|
||||||
|
$max_duration_seconds = intval( $data['duration'] );
|
||||||
|
$max_duration_episode_number = intval( $data['id'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------
|
||||||
|
// Get the Average Show
|
||||||
|
|
||||||
|
$ep_retrieve = "SELECT AVG(duration) as avg_duration FROM `eps` WHERE duration > 0";
|
||||||
|
if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||||
|
$data=mysqli_fetch_assoc($result);
|
||||||
|
$avg_duration_seconds = intval( $data['avg_duration'] );
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
// playtime
|
// playtime
|
||||||
$ep_retrieve = "SELECT SUM(duration) as total_playtime_all_hpr_shows_seconds FROM `eps`";
|
$ep_retrieve = "SELECT SUM(duration) as total_playtime_all_hpr_shows_seconds FROM `eps`";
|
||||||
@@ -75,6 +104,9 @@ $total_submitted_shows = $latest_episode_id + $total_twt_shows + $num_future_sho
|
|||||||
|
|
||||||
$project_age_seconds = strtotime( $start_date_twt ) - $current_time;
|
$project_age_seconds = strtotime( $start_date_twt ) - $current_time;
|
||||||
$project_age = convertSecToTime( $project_age_seconds );
|
$project_age = convertSecToTime( $project_age_seconds );
|
||||||
|
$min_duration = convertSecToTime( $min_duration_seconds );
|
||||||
|
$max_duration = convertSecToTime( $max_duration_seconds );
|
||||||
|
$avg_duration = convertSecToTime( $avg_duration_seconds );
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
@@ -114,6 +146,14 @@ $arr = array(
|
|||||||
'num_reserve_shows' => $num_reserve_shows,
|
'num_reserve_shows' => $num_reserve_shows,
|
||||||
'total_submitted_shows' => $total_submitted_shows,
|
'total_submitted_shows' => $total_submitted_shows,
|
||||||
'num_hosts' => $num_hosts,
|
'num_hosts' => $num_hosts,
|
||||||
|
'shortest_show_number' => $min_duration_episode_number,
|
||||||
|
'shortest_show_duration' => $min_duration,
|
||||||
|
'shortest_show_seconds' => $min_duration_seconds,
|
||||||
|
'longest_show_number' => $max_duration_episode_number,
|
||||||
|
'longest_show_duration' => $max_duration,
|
||||||
|
'longest_show_seconds' => $max_duration_seconds,
|
||||||
|
'average_show_length' => $avg_duration,
|
||||||
|
'average_show_length_seconds' => $avg_duration_seconds,
|
||||||
'days_to_next_free_slot' => "todo",
|
'days_to_next_free_slot' => "todo",
|
||||||
'total_playtime_all_shows_seconds' => $total_playtime_all_shows_seconds,
|
'total_playtime_all_shows_seconds' => $total_playtime_all_shows_seconds,
|
||||||
'total_playtime_all_shows_human_readable' => $total_playtime_all_shows_human_readable,
|
'total_playtime_all_shows_human_readable' => $total_playtime_all_shows_human_readable,
|
||||||
|
|||||||
Reference in New Issue
Block a user