match id visualization added
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Thu, 10 Oct 2013 05:10:15 +0000 (07:10 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Thu, 10 Oct 2013 05:10:15 +0000 (07:10 +0200)
TODO.txt
web/Obj/dbase_pgsql.phh
web/briskin5/Obj/briskin5.phh

index 9def6a8..fd75401 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -6,13 +6,16 @@
    - CONTINUE FEATURE
      DONE . save points every game
      DONE . modify points calculation to include order and mazzo
-     HALF . exclude not standard types from statistics
-         DONE . daily reports
-         . monthly stats
+     DONE . exclude not standard types from statistics
+         DONE . daily reports (1 for each active tournament)
+         DONE . monthly stats (for normal match only)
 
+     DONE . show current match ID when created
      . add command to continue
-     . investigate user reordering
-     . manage old games
+       . check consistency of the request
+     . rearrange users and game status to continue the selected match
+
+     . investigate user reordering ??
 
    - WEBSOCKET TRANSPORT
      . refactoring $enc attribute management
index 91a0426..abe9e73 100644 (file)
@@ -323,7 +323,7 @@ class BriskDB
                     log_crit(sprintf("bin5_points_save: failed at insert match [%s]", $mtc_sql));
                     break;
                 }
-                $mtc_obj = pg_fetch_object($mtc_pg,0);
+                $mtc_obj = pg_fetch_object($mtc_pg, 0);
 
                 for ($i = 0 ; $i < $n ; $i++) {
                     $ord_sql = sprintf("INSERT INTO %sbin5_table_orders (mcode, ucode, pos) VALUES (%d, %d, %d);",
@@ -379,7 +379,8 @@ class BriskDB
 
             $is_trans = FALSE;
 
-            $ret =  TRUE;
+            $table->match_id = $mtc_obj->code;
+            $ret = TRUE;
         } while (0);
 
         if ($is_trans)
index 068ea16..9701af9 100644 (file)
@@ -91,6 +91,8 @@ $mlang_bin5_bin5 = array(
                                                'en' => ' The game worth <b>%s</b>.' ),
                          'info_yshuf'=> array( 'it' => 'Fai <b>tu</b> il mazzo, ',
                                                'en' => 'It\'s <b>your</b> shuffled the cards, '),
+                         'info_match'=> array( 'it' => 'Il codice della partita รจ <b>%d</b>.',
+                                               'en' => 'Match code is <b>%d</b>.'),
                          'btn_bkgame'=> array( 'it' => 'torna alla partita',
                                                'en' => 'back to the game'),
                          'call_wptn' => array( 'it' => '<br>con %d punti',
@@ -180,6 +182,8 @@ class Bin5_table extends Table {
     var $briscola;
     var $friend;            // the callee idx position at table
 
+    var $match_id;          // the id of the match on the database (-1 == just not saved)
+
     var $old_act;           // last action that trigs the end of the game
     var $old_mazzo;
     var $old_reason;
@@ -217,6 +221,8 @@ class Bin5_table extends Table {
        $thiz->friend    =  -1;
        $thiz->turn      =   0;
 
+       $thiz->match_id     = -1;
+
        $thiz->old_act      = -1;
        $thiz->old_mazzo    = -1;
        $thiz->old_reason   = "";
@@ -257,6 +263,8 @@ class Bin5_table extends Table {
        $thiz->briscola     = $from->briscola;
        $thiz->friend       = $from->friend;
 
+       $thiz->match_id     = $from->match_id;
+
        $thiz->old_act      = $from->old_act;
        $thiz->old_mazzo    = $from->old_mazzo;
        $thiz->old_reason   = $from->old_reason;
@@ -289,6 +297,9 @@ class Bin5_table extends Table {
         $thiz->mazzo    = rand(0,PLAYERS_N-1);
         $thiz->points_n = 0;
         $thiz->mult     = 0;
+
+        $thiz->match_id     = -1;
+
         $thiz->old_asta_win = -1;
         $thiz->old_reason = "";
 
@@ -553,7 +564,7 @@ class Bin5_table extends Table {
                     // return($pts);
                     break;
                 }
-            
+
                 if ($pro >= $this->asta_pnt)
                     $sig = 1;
                 else
@@ -1795,6 +1806,10 @@ function show_table_info(&$bri, &$table, $table_pos)
         $noty .= sprintf($mlang_bin5_bin5['info_mult'][$G_lang], multoval($multer) );
     }
     $noty .= "<hr><br>";
+    if ($table->match_id != -1) {
+        $noty .= sprintf($mlang_bin5_bin5['info_match'][$G_lang], $table->match_id);
+        $noty .= "<hr><br>";
+    }
     $ret .= show_notify($noty, 3000, $mlang_bin5_bin5['btn_bkgame'][$G_lang], 500, 400);
     /* NOTE: show_notify($noty, 3000, "torna alla partita", 500,
      *                   130 + ($table->points_n > 0 ? 50 : 0) +
@@ -1915,13 +1930,12 @@ function game_description($act, $form, $old_mult, $win = -1, $win_name = "?1?",
     }
     else {
         $wol = game_result($old_asta_pnt, $old_pnt);
-        
+
         $noty = "";
-        
+
         if ($win != $fri) { // not alone case
-            
             /* MLANG: "<hr>Nell'ultima mano ha chiamato <b>%s</b>, il socio era <b>%s</b>,<br>", "hanno fatto <b>cappotto</b> EBBRAVI!.<hr>", "dovevano fare <b>%s</b> punti e ne hanno fatti <b>%d</b>: hanno <b>%s</b>.<hr>", "<hr>Nell'ultima mano <b>%s</b> si &egrave; chiamato in mano,<br>", "ha fatto <b>cappotto</b> EBBRAVO!.<hr>", "doveva fare <b>%s</b> punti e ne ha fatti <b>%d</b>: ha <b>%s</b>.<hr>", ($table->old_asta_pnt > 61 ? "almeno ".$table->old_asta_pnt : 'pi&ugrave; di 60'), $table->old_pnt, ($wol == 1 ? "vinto" : ($wol == 0 ? "pareggiato" : "perso" */
-            
+
             $noty .= sprintf($mlang_bin5_bin5['info_part'][$G_lang],
                              $tg_br, $tg_hr, $tg_bo, $tg_bc,
                              $win_name,