retrieve('timekeeper', '*', 'username="' . $userName . '"'); if(count($settingsHolder)==0) { exit; } $sql->gen("SELECT DISTINCT subject FROM e107_tkReport WHERE `username` = '$userName'"); while ($row = $sql->fetch()) { $subjects[] = $row['subject']; } $first = true; foreach ($subjects as $subject) { if($selects!=''){$selects .= ' UNION ';} $selects .= "(SELECT CAST((SUM(correct) / COUNT(id) * 100) AS DECIMAL (5 , 2 )) AS percent, COUNT(id) as `count`,'".ucfirst($subject)."' AS `subject` FROM e107_tkReport WHERE `username` = '$userName' AND `subject` = '$subject')"; if($first){ $selects .= " as subjects"; $first = false; } } $sql->gen("SELECT * FROM $selects;"); $text = '
| Subject | Score | No.Questions |
| ' . $row['subject'] . ' | ' . $row['percent'] . '% | ' . $row['count'] . ' |
' . $row['cntr'] . ' question has been answered
today with ' . $row['percent'] . '% accuracy.
'; }elseif(!(int)$row['cntr']==0) { $text .= '
' . $row['cntr'] . ' questions have been answered
today with ' . $row['percent'] . '% accuracy.
';
if($settingsHolder['minQuestionCount']<=$row['cntr']) {
$text .= '
';
$currentScore = e107::getDb()->retrieve('timekeeperScore', 'timekeeper_lifetimecorrect, timekeeper_lifetimequestions, timekeeper_minutes', 'timekeeper_username="' . $userName . '"');
$text .= '';
}else{
$text .= '';
}
}
}
$text .= '