]> git.treefish.org Git - banana.git/blobdiff - summary.php
...
[banana.git] / summary.php
index b59c7bb6e0b8b8015c5ba70ec84fb8209fea695a..d63c765add8912c4629db9b331cf90d7fc8e4cb4 100644 (file)
 
     block("black", "summary for " . $_POST['mnumber']);
 
-    print "<b>Examples Submitted</b>";
+    if ( isset($SESSIONS_next) ) {
+       print "<b>Submitted for next session on " . $SESSIONS[$SESSIONS_next]['timestr']  . "</b>";
+
+       print "<table>";
+
+       if($db->query("SELECT COUNT(*) FROM workdone WHERE mnumber = $mnumber AND session = $SESSIONS_next")->fetch(PDO::FETCH_NUM)[0] == 0) {
+         print "<tr><td>0 (0/" . $SESSIONS[$SESSIONS_next]['nexamples'] . ")</td></tr>";
+       }
+       else {
+         $wdone = $db->query("SELECT thisdone,manydone FROM workdone WHERE mnumber = $mnumber AND session = $SESSIONS_next")->fetch(PDO::FETCH_NUM);
+        print "<tr><td>" . $wdone[0] . "&nbsp;(" . $wdone[1] . "/" . $SESSIONS[$SESSIONS_next]['nexamples'] . ")</td></tr><br>";
+       }
+
+       print "</table>";
+
+       print "<br>";
+    }
+
+    print "<b>Examples submitted so far</b>";
     print "<table>";
 
     $tot_done = 0;
 
-    foreach ($SESSIONS as $session) {
-      if ($session['id'] == $SESSIONS_next) { break; }
+    if( isset($SESSIONS) ) {
+      foreach ($SESSIONS as $session) {
+        if ( isset($SESSIONS_next) ) {
+          if ($session['id'] == $SESSIONS_next) { break; }
+        }        
 
-      $exdone = $db->query("SELECT thisdone, manydone FROM workdone WHERE mnumber=" . $mnumber . " AND session=" . $session['id'])->fetch(PDO::FETCH_NUM);
+        $exdone = $db->query("SELECT thisdone, manydone FROM workdone WHERE mnumber=" . $mnumber . " AND session=" . $session['id'])->fetch(PDO::FETCH_NUM);
 
-      if ( $exdone[1] == "" ) { $exdone[1] = "0"; }
+        if ( $exdone[1] == "" ) { $exdone[1] = "0"; }
 
-      $tot_done = $tot_done + $exdone[1];
+        $tot_done = $tot_done + $exdone[1];
 
-      print "<tr>";
-      print "<td>" . $session['timestr'] . "&nbsp;&nbsp;</td>";
-      print "<td>" . $session['examples'] . "(" . $session['nexamples'] . ")" . "&nbsp;&nbsp;</td>";
-      print "<td>" . $exdone[1] . "/" . $session['nexamples'] . "(" . $exdone[0] . ")" . "&nbsp;&nbsp;</td>";
-      print "</tr>";
+        print "<tr>";
+        print "<td>" . $session['timestr'] . "&nbsp;&nbsp;</td>";
+        print "<td>" . $session['examples'] . "(" . $session['nexamples'] . ")" . "&nbsp;&nbsp;</td>";
+        print "<td>" . $exdone[1] . "/" . $session['nexamples'] . "(" . $exdone[0] . ")" . "&nbsp;&nbsp;</td>";
+        print "</tr>";
+      }
     }
     print "<tr>";
     print "<td></td><td></td><td><b>" . $tot_done . "/" . $SESSIONS_totex . "</b></td>";
@@ -53,7 +75,7 @@
 
 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
   <table bgcolor="black">
-    <tr><th><b><font color="white">Last submission</font></b></th><tr>
+    <tr><th><b><font color="white">Summary</font></b></th><tr>
   </table>
 
   <table>