| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | public function getInfo(int $examID): array |
||
| 10 | { |
||
| 11 | $stmt = $this->db->prepare('SELECT id, title, questions, threshold, group_id |
||
| 12 | FROM exams WHERE id = :id'); |
||
| 13 | $stmt->bindValue(':id', $examID, PDO::PARAM_INT); |
||
| 14 | $stmt->execute(); |
||
| 15 | |||
| 16 | $data = $stmt->fetch(PDO::FETCH_ASSOC); |
||
| 17 | |||
| 18 | if ($data['questions'] > 0) { |
||
| 19 | $data['thresholdPercentages'] = round($data['threshold'] / $data['questions'] * 100); |
||
| 20 | } |
||
| 21 | |||
| 22 | if (empty($data)) { |
||
| 23 | $data = []; |
||
| 24 | } |
||
| 25 | |||
| 26 | return $data; |
||
| 27 | } |
||
| 28 | } |
||
| 29 |