mirror of
https://github.com/idanoo/nzart-exam-generator.git
synced 2024-12-04 22:26:58 +00:00
Fixed average
This commit is contained in:
parent
121772cebc
commit
d262d86e11
15
index.php
15
index.php
@ -110,22 +110,21 @@ if (isset($_POST['mark'])) {
|
|||||||
$date = date("Y-m-d", $result->getTime());
|
$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']."). ".
|
$day[$date][] = date("h:i a", $result->getTime())." - Score ".(($score['correct']/$score['total'])*100)."% (".$score['correct']."/".$score['total']."). ".
|
||||||
"<a href='index.php?viewresult=".$result->getId()."'>View Result</a><br/>";
|
"<a href='index.php?viewresult=".$result->getId()."'>View Result</a><br/>";
|
||||||
if(!isset($day[$date]['total'])) {
|
$day[$date]['total'][] = ($score['correct'] / $score['total']) * 100;
|
||||||
$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) {
|
foreach ($day as $t=>$da) {
|
||||||
echo "<span style='font-weight:bold'>".$t."</span><br/>";
|
echo "<span style='font-weight:bold'>".$t."</span><br/>";
|
||||||
$total = $da['total'];
|
$total = 0;
|
||||||
|
foreach($da['total'] as $t) {
|
||||||
|
$total = $total+$t;
|
||||||
|
}
|
||||||
|
$total = round(($total/count($da['total'])),2);
|
||||||
unset($da['total']);
|
unset($da['total']);
|
||||||
foreach($da as $c=>$d) {
|
foreach($da as $c=>$d) {
|
||||||
echo $d;
|
echo $d;
|
||||||
}
|
}
|
||||||
echo round($total,2)."% Average<br/><br/>";
|
echo $total."% Average<br/><br/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user