NEW FEATURE: show number of tricks a person made
authorArun Persaud <arun@nubati.net>
Thu, 30 Apr 2009 07:08:10 +0000 (00:08 -0700)
committerArun Persaud <arun@nubati.net>
Tue, 12 May 2009 05:13:13 +0000 (22:13 -0700)
only shows 0,1,few or many tricks, so that we don't give too much information away. Might adjust or change this in the future.
This addresses issues #11.

css/standard021.css
include/db.php
include/functions.php
include/game.php

index 6488b8fd5c7063dc9d2107facecee85a228c0873..695792494e2dc59e6ab2a7ccc398bf7c42544c05 100644 (file)
@@ -270,7 +270,9 @@ hr {clear:both;}
 /*ul.tricks li:hover div.table{ display:block; }*/
 
 /* left player */
-ul.tricks li div div.card0 img,ul.tricks li div div.card0 .score, .vorbehalt0 {
+ul.tricks li div div.card0 img,
+ul.tricks li div div.card0 .score,
+.vorbehalt0 {
   position:absolute;
   margin:0;
   padding:0;
@@ -281,6 +283,7 @@ ul.tricks li div div.card0 img,ul.tricks li div div.card0 .score, .vorbehalt0 {
   width:6%;
   z-index:30;
 }
+
 .vorbehalt0 {
   left:37.5%;
   right:57.5%;
@@ -299,7 +302,9 @@ ul.tricks li div div.card0 span.comment{
 }
 
 /* top player */
-ul.tricks li div div.card1 img,ul.tricks li div div.card1 .score, .vorbehalt1 {
+ul.tricks li div div.card1 img,
+ul.tricks li div div.card1 .score,
+.vorbehalt1 {
   position:absolute;
   margin:0;
   padding:0;
@@ -330,7 +335,9 @@ ul.tricks li div div.card1 span.comment{
 }
 
 /* right player */
-ul.tricks li div div.card2 img,ul.tricks li div div.card2 .score, .vorbehalt2{
+ul.tricks li div div.card2 img,
+ul.tricks li div div.card2 .score,
+.vorbehalt2{
   position:absolute;
   margin:0;
   padding:0;
@@ -360,7 +367,9 @@ ul.tricks li div div.card2 span.comment{
 }
 
 /* bottom player */
-ul.tricks li div div.card3 img,ul.tricks li div div.card3 .score, .vorbehalt3{
+ul.tricks li div div.card3 img,
+ul.tricks li div div.card3 .score,
+.vorbehalt3{
   position:absolute;
   margin:0;
   padding:0;
index 3d9d98c9cf9272b83b5d0f5390fc359398f6bb56..b8b184dd7673d73e8aaca176248b16fbfe89c347 100644 (file)
@@ -1149,4 +1149,10 @@ function DB_played_by_others($gameid)
       $gameids[]=$r[0];
   return $gameids;
 }
+
+function DB_get_number_of_tricks($gameid,$position)
+{
+  $r = DB_query_array("SELECT COUNT(winner) FROM Trick Where game_id='$gameid' and winner='$position'");
+  return $r[0];
+}
 ?>
\ No newline at end of file
index e57c2e593f8a7bd5fc915423f76f31b19a721f9d..3e21e6d3e4ebcc82253879b3cf237b38eff33654 100644 (file)
@@ -816,6 +816,7 @@ function display_table ()
       $call      = $r[5];
       $hash      = $r[7];
       $timezone  = $r[8];
+      $wins      = DB_get_number_of_tricks($gameid,$pos);
       date_default_timezone_set($defaulttimezone);
       $lastlogin = strtotime($r[6]);
       date_default_timezone_set($timezone);
@@ -939,6 +940,22 @@ function display_table ()
                             "last login: ".date("Y-m-d H:i:s",$lastlogin)."\">".
                             "<img src=\"pics/button/time-info.png\" class=\"tinybutton\" alt=\"time info\" />".
                             "</span>\n";
+
+      /* show how many tricks the person made */
+      switch($wins)
+       {
+       case 0:
+         echo "#tricks 0"; break;
+       case 1:
+         echo "#tricks 1"; break;
+       case 2:
+       case 3:
+       case 4:
+         echo "#tricks few"; break;
+       default:
+         echo "#tricks many"; break;
+       }
+
       echo "   </div>\n";
 
     }
index f9daf6523dc916dd7517854925c98d5fcdbf9fec..a11e6b6eb48d64c56370b2c497dcfbaeb402e753 100644 (file)
@@ -1295,6 +1295,7 @@ switch($mystatus)
        /* end of trick? */
        if($seq==4)
          {
+           $winner    = get_winner($play,$gametype); /* returns the position */
            echo "    </div>\n  </li>\n";  /* end div trick, end li trick */
          }
       }