X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fbriskin5%2Fstat-day.php;h=4bd60cebd102e1364e596074b0c3b6b37c433928;hb=66eaf1176bb114a40111960b5467201efef2b247;hp=16781204e621f647da8a7adf3f97aae95f7d006d;hpb=7d6de01c21200b7283b6dd5ba1a39a3a2741ad54;p=brisk.git
diff --git a/web/briskin5/stat-day.php b/web/briskin5/stat-day.php
index 1678120..4bd60ce 100644
--- a/web/briskin5/stat-day.php
+++ b/web/briskin5/stat-day.php
@@ -43,7 +43,10 @@ $G_base = "../";
$mlang_stat_day = array( 'normal match'=> array( 'it' => 'Partite normali',
'en' => 'Normal matches' ),
'special match' => array( 'it' => 'Partite speciali',
- 'en' => 'Special matches')
+ 'en' => 'Special matches'),
+
+ 'info_total'=> array( 'it' => 'totali',
+ 'en' => 'En totali')
);
@@ -266,7 +269,7 @@ function main_pgsql($from, $to)
for ($t = 0 ; $t < $trn_n ; $t++) {
$trn_obj = pg_fetch_object($trn_pg, $t);
- $tmt_sql = sprintf("SELECT m.code AS code FROM %sbin5_matches AS m, %sbin5_games AS g, %sbin5_tournaments as t WHERE t.code = m.tcode AND m.code = g.mcode AND t.code = %d AND g.tstamp >= '%s' AND g.tstamp < '%s' GROUP BY m.code;",
+ $tmt_sql = sprintf("SELECT m.code AS code, m.mazzo_next as minus_one_is_old FROM %sbin5_matches AS m, %sbin5_games AS g, %sbin5_tournaments as t WHERE t.code = m.tcode AND m.code = g.mcode AND t.code = %d AND g.tstamp >= '%s' AND g.tstamp < '%s' GROUP BY m.code, minus_one_is_old ORDER BY m.code, minus_one_is_old DESC;",
$G_dbpfx, $G_dbpfx, $G_dbpfx, $trn_obj->code, $from, $to);
// if deletable old matches exists then ...
@@ -294,14 +297,22 @@ function main_pgsql($from, $to)
fprintf($fpexp, "
");
$tmt_obj = pg_fetch_object($tmt_pg, $m);
- $usr_sql = sprintf("
+ if ($tmt_obj->minus_one_is_old > -1) { // is new
+ $usr_sql = sprintf("
SELECT u.code AS code, u.login AS login, min(g.tstamp) AS first, max(g.tstamp) AS last, m.tidx AS tidx FROM %sbin5_matches AS m, %sbin5_games AS g, %sbin5_points AS p, %susers AS u, %sbin5_table_orders AS o WHERE m.code = g.mcode AND g.code = p.gcode AND u.code = p.ucode AND m.code = %d AND m.code = o.mcode AND u.code = o.ucode GROUP BY u.code, u.login, m.tidx, o.pos ORDER BY o.pos;", $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, $tmt_obj->code);
+ }
+ else { // is old
+ $usr_sql = sprintf("
+SELECT u.code AS code, u.login AS login, min(g.tstamp) AS first, max(g.tstamp) AS last, m.tidx AS tidx FROM %sbin5_matches AS m, %sbin5_games AS g, %sbin5_points AS p, %susers AS u WHERE m.code = g.mcode AND g.code = p.gcode AND u.code = p.ucode AND m.code = %d GROUP BY u.code, u.login, m.tidx;", $G_dbpfx, $G_dbpfx, $G_dbpfx, $G_dbpfx, $tmt_obj->code);
+ }
if (($usr_pg = pg_query($bdb->dbconn->db(), $usr_sql)) == FALSE ) {
+ log_crit("stat-day: pg_query usr_sql failed");
break;
}
$usr_n = pg_numrows($usr_pg);
if ($usr_n != BIN5_PLAYERS_N) {
+ log_crit("stat-day: wrong number of players");
break;
}
@@ -338,22 +349,29 @@ SELECT u.code AS code, u.login AS login, min(g.tstamp) AS first, max(g.tstamp) A
if ($u != BIN5_PLAYERS_N) {
break;
}
- fprintf($fpexp, "