forked from HPR/hpr_hub
Fix stats page hpr shows
This commit is contained in:
parent
7fdf12df28
commit
112f443a04
@ -33,8 +33,27 @@ $agehpr = $hpr_startdate;
|
|||||||
|
|
||||||
$last_show = mysqli_query($connection, "SELECT max(date), max(id) from eps");
|
$last_show = mysqli_query($connection, "SELECT max(date), max(id) from eps");
|
||||||
$last_show_date = mysqli_fetch_row($last_show);
|
$last_show_date = mysqli_fetch_row($last_show);
|
||||||
$totalshows=$last_show_date[1]+300;
|
|
||||||
$totalhpr=$last_show_date[1];
|
// --------------------------------------------
|
||||||
|
// Reserve Shows
|
||||||
|
|
||||||
|
$result = mysqli_query($connection, 'SELECT COUNT(*) FROM reservations WHERE status="RESERVE_SHOW_SUBMITTED";');
|
||||||
|
if (!isset($result)) {
|
||||||
|
naughty("cac33babd8a24edd138087ef7e4280f6");
|
||||||
|
}
|
||||||
|
$reserve_array = mysqli_fetch_row( $result );
|
||||||
|
$reserve_shows = $reserve_array[0];
|
||||||
|
mysqli_free_result($result);
|
||||||
|
|
||||||
|
// --------------------------------------------
|
||||||
|
// Get total number of shows
|
||||||
|
|
||||||
|
$ep_retrieve = "SELECT id, COUNT(*) AS total_hpr_shows FROM eps ;";
|
||||||
|
if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||||
|
$data=mysqli_fetch_assoc($result);
|
||||||
|
$total_hpr_shows = $data['total_hpr_shows'];
|
||||||
|
}
|
||||||
|
$total_shows=$last_show_date[1]+300+$reserve_shows;
|
||||||
|
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
// Get the number of hosts
|
// Get the number of hosts
|
||||||
@ -144,17 +163,6 @@ $data=mysqli_fetch_assoc($result);
|
|||||||
$total_duration = $data['total_duration'];
|
$total_duration = $data['total_duration'];
|
||||||
$human_total_duration = convertSecToTime($total_duration);
|
$human_total_duration = convertSecToTime($total_duration);
|
||||||
|
|
||||||
// --------------------------------------------
|
|
||||||
// Reserve Shows
|
|
||||||
|
|
||||||
$result = mysqli_query($connection, 'SELECT COUNT(*) FROM reservations WHERE status="RESERVE_SHOW_SUBMITTED";');
|
|
||||||
if (!isset($result)) {
|
|
||||||
naughty("cac33babd8a24edd138087ef7e4280f6");
|
|
||||||
}
|
|
||||||
$reserve_array = mysqli_fetch_row( $result );
|
|
||||||
$reserve_shows = $reserve_array[0];
|
|
||||||
mysqli_free_result($result);
|
|
||||||
|
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
// workflow
|
// workflow
|
||||||
|
|
||||||
@ -225,9 +233,9 @@ if ($format === "json") {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
\"shows\": {
|
\"shows\": {
|
||||||
\"total\": ".$totalshows.",
|
\"total\": ".$total_shows.",
|
||||||
\"twat\": 300,
|
\"twat\": 300,
|
||||||
\"hpr\": ".$totalhpr.",
|
\"hpr\": ".$total_hpr_shows.",
|
||||||
\"duration\": ".$total_duration.",
|
\"duration\": ".$total_duration.",
|
||||||
\"human_duration\": \"".$human_total_duration."\"
|
\"human_duration\": \"".$human_total_duration."\"
|
||||||
},
|
},
|
||||||
@ -271,9 +279,9 @@ elseif ($format === "xml") {
|
|||||||
</since_rename>
|
</since_rename>
|
||||||
</age>
|
</age>
|
||||||
<shows>
|
<shows>
|
||||||
<total>".$totalshows."</total>
|
<total>".$total_shows."</total>
|
||||||
<twat>300</twat>
|
<twat>300</twat>
|
||||||
<hpr>".$totalhpr."</hpr>
|
<hpr>".$total_hpr_shows."</hpr>
|
||||||
<duration>".$total_duration."</duration>
|
<duration>".$total_duration."</duration>
|
||||||
<human_duration>".$human_total_duration."</human_duration>
|
<human_duration>".$human_total_duration."</human_duration>
|
||||||
</shows>
|
</shows>
|
||||||
@ -305,9 +313,9 @@ else {
|
|||||||
header("Content-disposition: inline; filename=hpr_stats.txt");
|
header("Content-disposition: inline; filename=hpr_stats.txt");
|
||||||
printf("Started:\t%d years, %d months, %d days ago (2005-09-19)\n", $twat_years, $twat_months, $twat_days);
|
printf("Started:\t%d years, %d months, %d days ago (2005-09-19)\n", $twat_years, $twat_months, $twat_days);
|
||||||
printf("Renamed HPR:\t%d years, %d months, %d days ago (2007-12-31)\n", $hpr_years, $hpr_months, $hpr_days);
|
printf("Renamed HPR:\t%d years, %d months, %d days ago (2007-12-31)\n", $hpr_years, $hpr_months, $hpr_days);
|
||||||
echo "Total Shows:\t" . $totalshows . "\n";
|
echo "Total Shows:\t" . $total_shows . "\n";
|
||||||
echo "Total TWAT:\t300\n";
|
echo "Total TWAT:\t300\n";
|
||||||
echo "Total HPR:\t" . $totalhpr . "\n";
|
echo "Total HPR:\t" . $total_hpr_shows . "\n";
|
||||||
echo "Duration:\t" . $total_duration . "\n";
|
echo "Duration:\t" . $total_duration . "\n";
|
||||||
echo "Human Duration:\t" . $human_total_duration . "\n";
|
echo "Human Duration:\t" . $human_total_duration . "\n";
|
||||||
echo "HPR Hosts:\t${num_of_hosts}\n";
|
echo "HPR Hosts:\t${num_of_hosts}\n";
|
||||||
@ -318,7 +326,7 @@ else {
|
|||||||
echo "Files on the FTP Server:\t$new_shows\n";
|
echo "Files on the FTP Server:\t$new_shows\n";
|
||||||
echo "Number of Reserve Shows:\t$reserve_shows\n";
|
echo "Number of Reserve Shows:\t$reserve_shows\n";
|
||||||
echo "Days until show without media:\t$un_delivered\n";
|
echo "Days until show without media:\t$un_delivered\n";
|
||||||
print "$current_time,$agetwat,$agehpr,$totalshows,300,$totalhpr,$num_of_hosts,$days_to_wait,$num_future_hosts,$num_future_shows,$unprocessed_comments,$new_shows,$reserve_shows,$un_delivered";
|
print "$current_time,$agetwat,$agehpr,$total_shows,300,$total_hpr_shows,$num_of_hosts,$days_to_wait,$num_future_hosts,$num_future_shows,$unprocessed_comments,$new_shows,$reserve_shows,$un_delivered";
|
||||||
// print_r($show_array);
|
// print_r($show_array);
|
||||||
}
|
}
|
||||||
mysqli_close($connection);
|
mysqli_close($connection);
|
||||||
|
Loading…
Reference in New Issue
Block a user