From: Matteo Nastasi (mop) Date: Thu, 10 Oct 2013 05:10:15 +0000 (+0200) Subject: match id visualization added X-Git-Tag: v4.10.0^2~14 X-Git-Url: https://mop.ddnsfree.com/gitweb/?p=brisk.git;a=commitdiff_plain;h=ca4114fe5a3d9afe1d3b6861128fa96720f738f5 match id visualization added --- diff --git a/TODO.txt b/TODO.txt index 9def6a8..fd75401 100644 --- 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 diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index 91a0426..abe9e73 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -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) diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 068ea16..9701af9 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -91,6 +91,8 @@ $mlang_bin5_bin5 = array( 'en' => ' The game worth %s.' ), 'info_yshuf'=> array( 'it' => 'Fai tu il mazzo, ', 'en' => 'It\'s your shuffled the cards, '), + 'info_match'=> array( 'it' => 'Il codice della partita è %d.', + 'en' => 'Match code is %d.'), 'btn_bkgame'=> array( 'it' => 'torna alla partita', 'en' => 'back to the game'), 'call_wptn' => array( 'it' => '
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 .= "

"; + if ($table->match_id != -1) { + $noty .= sprintf($mlang_bin5_bin5['info_match'][$G_lang], $table->match_id); + $noty .= "

"; + } $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: "
Nell'ultima mano ha chiamato %s, il socio era %s,
", "hanno fatto cappotto EBBRAVI!.
", "dovevano fare %s punti e ne hanno fatti %d: hanno %s.
", "
Nell'ultima mano %s si è chiamato in mano,
", "ha fatto cappotto EBBRAVO!.
", "doveva fare %s punti e ne ha fatti %d: ha %s.
", ($table->old_asta_pnt > 61 ? "almeno ".$table->old_asta_pnt : 'più 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,