| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | public function trackingContent(HookMyStudentsLpTrackingEventInterface $hook) |
||
| 37 | { |
||
| 38 | $data = $hook->getEventData(); |
||
| 39 | |||
| 40 | $totalCount = WhispeakAuthPlugin::countAllAttemptsInLearningPath($data['lp_id'], $data['student_id']); |
||
| 41 | |||
| 42 | if (0 === $totalCount) { |
||
| 43 | return [ |
||
| 44 | 'value' => '-', |
||
| 45 | 'attrs' => ['class' => 'text-center'], |
||
| 46 | ]; |
||
| 47 | } |
||
| 48 | |||
| 49 | $successCount = WhispeakAuthPlugin::countSuccessAttemptsInLearningPath($data['lp_id'], $data['student_id']); |
||
| 50 | |||
| 51 | $attrs = ['class' => 'text-center ']; |
||
| 52 | $attrs['class'] .= $successCount <= $totalCount / 2 ? 'text-danger' : 'text-success'; |
||
| 53 | |||
| 54 | return [ |
||
| 55 | 'value' => Display::tag('strong', "$successCount / $totalCount"), |
||
| 56 | 'attrs' => $attrs, |
||
| 57 | ]; |
||
| 60 |