summaryrefslogtreecommitdiff
path: root/sqlbox/reportall.php
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-30 14:50:04 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-30 14:54:08 +0100
commita3eb8b3f0be1154b1f59ce67648abe74228c56f2 (patch)
treef6c01d16a903785a284ad749ac80b8f282a2bc10 /sqlbox/reportall.php
parent0e577b48ff53065fd337f796ce8a3f7cd4cd59c4 (diff)
downloadsqltutor-plugin-a3eb8b3f0be1154b1f59ce67648abe74228c56f2.tar.gz
sqltutor-plugin-a3eb8b3f0be1154b1f59ce67648abe74228c56f2.tar.bz2
sqltutor-plugin-a3eb8b3f0be1154b1f59ce67648abe74228c56f2.zip
reportall: Show users progress
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);