summaryrefslogtreecommitdiff
path: root/sqlbox/reportall.php
diff options
context:
space:
mode:
Diffstat (limited to 'sqlbox/reportall.php')
-rw-r--r--sqlbox/reportall.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/sqlbox/reportall.php b/sqlbox/reportall.php
index 2e002b4..c3a2813 100644
--- a/sqlbox/reportall.php
+++ b/sqlbox/reportall.php
@@ -44,8 +44,8 @@ foreach ($boxes as $box)
$b[$box->id] = $box->name;
$table = new html_table;
-$table->head = array_merge(array("Nutzer"), $b);
-$table->align = array_merge(array("left"), array_fill(0, count($b), 'center'));
+$table->head = array_merge(array("Nutzer", "Fortschritt"), $b);
+$table->align = array_merge(array("left", "left"), array_fill(0, count($b), 'center'));
$users = $DB->get_records("user", array('deleted'=>'0'));
foreach ($users as $user) {
@@ -60,10 +60,15 @@ foreach ($users as $user) {
ON s.id = sol.sqlboxid ORDER BY s.id",
array('id'=>$user->id));
$s = array();
- foreach ($solutions as $solution)
+ $progress = 0;
+ foreach ($solutions as $solution) {
$s[$solution->id] = ($solution->correct == '1') ? '☑' : ($solution->correct == '0' ? '☒' : '☐');
+ if ($solution->correct == '1')
+ $progress++;
+ }
+ $progress /= count($s);
- $table->data[] = array_merge(array($name), $s);
+ $table->data[] = array_merge(array($name, round($progress * 100) . "%"), $s);
}
echo html_writer::table($table);