@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | |
22 | 22 | $points = 0; |
23 | 23 | function normalize($numerator, $denominator = false) { |
24 | - global $points; |
|
25 | - $denominator = ($denominator !== false ? $denominator : $points); |
|
26 | - $points = $denominator; |
|
27 | - return min(100, $numerator / $denominator * 100); |
|
24 | + global $points; |
|
25 | + $denominator = ($denominator !== false ? $denominator : $points); |
|
26 | + $points = $denominator; |
|
27 | + return min(100, $numerator / $denominator * 100); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | header('Content-Type: application/javascript'); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $analytics = $toolbox->cache_get('analytics'); |
36 | 36 | if ($analytics === false) { |
37 | - exit; |
|
37 | + exit; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | ?> |
@@ -47,29 +47,29 @@ discard block |
||
47 | 47 | |
48 | 48 | <?php |
49 | 49 | |
50 | - $labels = array(); |
|
51 | - $max_scores = array(); |
|
52 | - $min_scores = array(); |
|
53 | - $medians = array(); |
|
54 | - $first_quartiles = array(); |
|
55 | - $third_quartiles = array(); |
|
56 | - $scores = array(); |
|
57 | - foreach ($analytic as $data) { |
|
58 | - if ($data['points_possible'] > 0 && $data['max_score'] > 0) { |
|
59 | - $labels[] = ''; // htmlentities($data['title']); |
|
60 | - $max_scores[] = normalize($data['max_score'], $data['points_possible']); |
|
61 | - $min_scores[] = normalize($data['min_score']); |
|
62 | - $medians[] = normalize($data['median']); |
|
63 | - $first_quartiles[] = normalize($data['first_quartile']); |
|
64 | - $third_quartiles[] = normalize($data['third_quartile']); |
|
65 | - if (empty($data['submission'])) { |
|
66 | - $scores[] = '""'; /* some assignments may not have grades */ |
|
67 | - } else { |
|
68 | - $scores[] = normalize($data['submission']['score']); |
|
69 | - } |
|
70 | - } |
|
71 | - } |
|
72 | - ?> |
|
50 | + $labels = array(); |
|
51 | + $max_scores = array(); |
|
52 | + $min_scores = array(); |
|
53 | + $medians = array(); |
|
54 | + $first_quartiles = array(); |
|
55 | + $third_quartiles = array(); |
|
56 | + $scores = array(); |
|
57 | + foreach ($analytic as $data) { |
|
58 | + if ($data['points_possible'] > 0 && $data['max_score'] > 0) { |
|
59 | + $labels[] = ''; // htmlentities($data['title']); |
|
60 | + $max_scores[] = normalize($data['max_score'], $data['points_possible']); |
|
61 | + $min_scores[] = normalize($data['min_score']); |
|
62 | + $medians[] = normalize($data['median']); |
|
63 | + $first_quartiles[] = normalize($data['first_quartile']); |
|
64 | + $third_quartiles[] = normalize($data['third_quartile']); |
|
65 | + if (empty($data['submission'])) { |
|
66 | + $scores[] = '""'; /* some assignments may not have grades */ |
|
67 | + } else { |
|
68 | + $scores[] = normalize($data['submission']['score']); |
|
69 | + } |
|
70 | + } |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | |
74 | 74 | var data = { |
75 | 75 | labels: [<?= '"' . implode('", "', $labels) . '"' ?>], |