BUGFIX: fixed some small typo/layout issues in the "game over" email
authorArun Persaud <arun@nubati.net>
Sat, 1 Nov 2008 18:51:00 +0000 (11:51 -0700)
committerArun Persaud <arun@nubati.net>
Sat, 1 Nov 2008 18:51:00 +0000 (11:51 -0700)
added a line break, made the score table look better

Signed-off-by: Arun Persaud <arun@nubati.net>
include/functions.php
include/game.php

index ecb9811a4028bade70286e75b56e22d9d47cb21b..db7ccadb059a747f422dd7481f74151b341ae41f 100644 (file)
@@ -1010,7 +1010,9 @@ function format_score_table_ascii($score)
   if(sizeof($score)==0)
     return "";
 
   if(sizeof($score)==0)
     return "";
 
-  //  if(sizeof($score)>5) $header.=   "                ...   \n";
+  /* truncate table if we have too many games */
+  $max = sizeof($score);
+  if($max>6) $output.=" (table truncated to last 6 games)\n";
 
   /* output header */
   foreach($score[0]['players'] as $id=>$points)
 
   /* output header */
   foreach($score[0]['players'] as $id=>$points)
@@ -1018,18 +1020,16 @@ function format_score_table_ascii($score)
       $name = DB_get_name('userid',$id); /*TODO*/
       $output.= "  ".substr($name,0,2)."  |";
     }
       $name = DB_get_name('userid',$id); /*TODO*/
       $output.= "  ".substr($name,0,2)."  |";
     }
-  $output.="  P   |\n ";
+  $output.="  P   |\n";
   $output.= "------+------+------+------+------+\n";
 
   $output.= "------+------+------+------+------+\n";
 
-  $max = sizeof($score);
+  /* output score for each game */
   $i=0;
   $i=0;
-
-  if($i<$max-6) $output.="       ...\n";
-
   foreach($score as $game)
     {
       $i++;
       if($i-1<$max-6) continue;
   foreach($score as $game)
     {
       $i++;
       if($i-1<$max-6) continue;
+
       foreach($game['players'] as $id=>$points)
        $output.=str_pad($points,6," ",STR_PAD_LEFT)."|";
       $output.=str_pad($game['points'],4," ",STR_PAD_LEFT);
       foreach($game['players'] as $id=>$points)
        $output.=str_pad($points,6," ",STR_PAD_LEFT)."|";
       $output.=str_pad($game['points'],4," ",STR_PAD_LEFT);
index cfd1750e9c393babecf117372b6ee60776d381bb..b2df36918e6624e94f8739a14e32764eac5d98d5 100644 (file)
@@ -1767,7 +1767,7 @@ switch($mystatus)
 
                  $message .= "Score Table:\n";
                  $message .= format_score_table_ascii($score);
 
                  $message .= "Score Table:\n";
                  $message .= format_score_table_ascii($score);
-                 $message .= "Use these links to have a look at game ".DB_format_gameid($gameid).": \n";
+                 $message .= "\nUse these links to have a look at game ".DB_format_gameid($gameid).": \n";
 
                  /* send out final email */
                  $all = array();
 
                  /* send out final email */
                  $all = array();