Added more logging, and info on show length to stats

This commit is contained in:
2026-05-25 13:27:45 +02:00
parent 6f7b8a60ff
commit 22bf6c13ca
2 changed files with 50 additions and 7 deletions

View File

@@ -51,6 +51,35 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
$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
$ep_retrieve = "SELECT SUM(duration) as total_playtime_all_hpr_shows_seconds FROM `eps`";
@@ -74,7 +103,10 @@ $total_released_shows = $latest_episode_id + $total_twt_shows;
$total_submitted_shows = $latest_episode_id + $total_twt_shows + $num_future_shows + $num_reserve_shows;
$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,
'total_submitted_shows' => $total_submitted_shows,
'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",
'total_playtime_all_shows_seconds' => $total_playtime_all_shows_seconds,
'total_playtime_all_shows_human_readable' => $total_playtime_all_shows_human_readable,