From a3eb8b3f0be1154b1f59ce67648abe74228c56f2 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Wed, 30 Jan 2013 14:50:04 +0100 Subject: reportall: Show users progress --- doc/documentation.txt | 4 ++-- sqlbox/reportall.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/documentation.txt b/doc/documentation.txt index aed3fe7..9ed9782 100644 --- a/doc/documentation.txt +++ b/doc/documentation.txt @@ -79,10 +79,10 @@ Der die SQL-Anfrage der Muterloesung sowie die des Studenten werden beide nacheinander auf einer Realen PostgreSQL-Datenbank ausgefuert. Die dabei entstehenden Antworten werden verglichen und bei Uebereinstimmung gilt gilt diese Aufgabe fuer den Studenten als Bestanden. -Der Tutor kann den Lernsoftschritt aller Studenten Anhand einer +Der Tutor kann den Lernsoftschritt aller Studenten anhand einer Uebersichtstabelle verfolgen. In dieser Tabelle werden alle SQLBox-Aufgaben sowie alle Bentzer einander -gegenueber gestellt. +gegenueber gestellt und zusätzlich der Gesamtfortschritt pro Benutzer angezeigt. === Das Test-Szenario 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); -- cgit