From d7133155ffca7166814a395b6d18e8e2a6f997e7 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Mon, 2 Jan 2017 19:29:34 +1300 Subject: [PATCH] Styled results page - TODO timezones... --- index.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index ee1acf6..42d453e 100755 --- a/index.php +++ b/index.php @@ -101,15 +101,33 @@ if (isset($_POST['mark'])) { 600 Questions (All Questions)

Score ".(($score['correct']/$score['total'])*100)."% (".$score['correct']."/".$score['total'].")"; echo $output; } elseif (isset($results)) { - foreach ($results as $result) { + $day = []; + foreach ($results as $i=>$result) { $score = $result->getScore(); - echo date("Y-m-d", $result->getTime())." Score ".(($score['correct']/$score['total'])*100)."% (".$score['correct']."/".$score['total']."). ". + $date = date("Y-m-d", $result->getTime()); + $day[$date][] = date("h:i a", $result->getTime())." - Score ".(($score['correct']/$score['total'])*100)."% (".$score['correct']."/".$score['total']."). ". "View Result
"; + if(!isset($day[$date]['total'])) { + $day[$date]['total'] = ($score['correct'] / $score['total']) * 100; + } else { + $original = $day[$date]['total']; + $day[$date]['total'] = ($original + (($score['correct'] / $score['total']) * 100)) / 2; + } } + + foreach ($day as $t=>$da) { + echo "".$t."
"; + $total = $da['total']; + unset($da['total']); + foreach($da as $c=>$d) { + echo $d; + } + echo $total."% Average

"; + } + } else { if(!is_object($user)) { ?> Please Login to track results.