= 40)
$label = "warning";
if($ratio >= 80)
$label = "success";
$table .= "
";
$table .= "| " . $result['title'] . " | ";
$table .= "" . $result['difficulty'] . " | ";
$table .= "" . $ratio . "% | ";
$table .= "" . $result['buttons_pressed'] . " | ";
$table .= "" . $result['joystick_moved'] . " | ";
$table .= "" . format($result['play_time'])['string'] . " | ";
$table .= "" . $result['start_time'] . " | ";
$table .= "
";
}
// ======================================================
// DATA POINTS FOR MOST PLAYED GRAPH
// DATA POINTS FOR AVERAGE PLAY TIME GRAPH
// ======================================================
$most_played_array = array();
$average_play_time_array = array();
$query = "SELECT DATE(`start_time`) AS date, COUNT(*) AS data, AVG(`play_time`) AS average
FROM `playdata`
GROUP BY DATE(`start_time`)
ORDER BY `start_time` DESC
LIMIT 0,14";
$result_temp = mysqli_query($connection, $query);
while($result = mysqli_fetch_assoc($result_temp))
{
$most_played_array[] = "{y: '" . $result['date'] . "', gp: " . $result['data'] . "}";
$average_play_time_array[] = "{y: '" . $result['date'] . "', pt: " . format($result['average'])['tseconds'] . "}";
}
$most_played_array = array_reverse($most_played_array);
$average_play_time_array = array_reverse($average_play_time_array);
// ======================================================
// PERCENTAGE OF DIFFICULTY
// ======================================================
$easy = 0;
$medium = 0;
$hard = 0;
$other = 0;
$query = "SELECT `difficulty`, COUNT(1) as num, COUNT(1) / (SELECT COUNT(1) FROM `playdata` ) * 100 as avg
FROM `songinstance` AS si, `playdata` as pd
WHERE si.id = pd.songinstance
GROUP BY `difficulty`";
$result_temp = mysqli_query($connection, $query);
while($result = mysqli_fetch_assoc($result_temp))
{
if(strtolower($result['difficulty']) == "easy")
{
$easy = $easy + round($result['avg']);
}
else if(strtolower($result['difficulty']) == "medium")
{
$medium = $medium + round($result['avg']);
}
else if(strtolower($result['difficulty']) == "hard")
{
$hard = $hard + round($result['avg']);
}
else
{
$other = $other + $result['avg'];
}
}
$other = round($other);
?>
| Song Name |
Difficulty |
Hit Ratio |
Buttons Pressed |
Joystick Moved |
Length |
Time |