X-Git-Url: http://mop.ddnsfree.com/gitweb/?p=brisk.git;a=blobdiff_plain;f=web%2FObj%2Fdbase_pgsql.phh;h=26dcf3570c0885160421cb43c1733778ed25bbb6;hp=a757c09173c11330055fe930dd14acc16a1afdee;hb=a222ac87c9aa8297cc7dd4ede7c9b92089d52238;hpb=649907a529ae4bee21990c05f196a144dab8624b diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index a757c09..26dcf35 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -628,15 +628,6 @@ class BriskDB } $gam_obj = pg_fetch_object($gam_pg, 0); - // FIXME - $rules_name = "Rules_old_rules"; - $table->old_reason = ${rules_name}::game_description($gam_obj->act, 'html', $gam_obj->mult, - $gam_obj->asta_win, ($gam_obj->asta_win != -1 ? - $users[$gam_obj->asta_win]['login'] : ""), - $gam_obj->friend, ($gam_obj->friend != -1 ? - $users[$gam_obj->friend]['login'] : ""), - $gam_obj->pnt, $gam_obj->asta_pnt, $gam_obj->tourn_pts); - // update matches with new ttok and table idx $mtc_sql = sprintf("UPDATE %sbin5_matches SET (ttok, tidx) = ('%s', %d) WHERE code = %d RETURNING *;", $G_dbpfx, $sql_ttok, $tidx, $match_code); @@ -644,6 +635,20 @@ class BriskDB log_crit(sprintf("%s::%s: update matches table failed", __CLASS__, __FUNCTION__)); return (FALSE); } + $mtc_obj = pg_fetch_object($mtc_pg, 0); + + $old_rules = $table->rules; + $rules_name = rules_id2name($mtc_obj->tcode); + $table->rules = new $rules_name($table); + unset($old_rules); + + $table->old_reason = ${rules_name}::game_description($gam_obj->act, 'html', $gam_obj->mult, + $gam_obj->asta_win, ($gam_obj->asta_win != -1 ? + $users[$gam_obj->asta_win]['login'] : ""), + $gam_obj->friend, ($gam_obj->friend != -1 ? + $users[$gam_obj->friend]['login'] : ""), + $gam_obj->pnt, $gam_obj->asta_pnt, $gam_obj->tourn_pts); + return (TRUE); } @@ -716,7 +721,7 @@ class BriskDB // match not exists, insert it // , BIN5_TOURNAMENT_NO_DRAW $mtc_sql = sprintf("INSERT INTO %sbin5_matches (ttok, tidx, mazzo_next, mult_next, tcode) VALUES ('%s', %d, %d, %d, %d) RETURNING *;", - $G_dbpfx, $sql_ttok, $tidx, $table->mazzo, $table->mult, BIN5_TOURNAMENT_OLDRULES); + $G_dbpfx, $sql_ttok, $tidx, $table->mazzo, $table->mult, BIN5_TOURNAMENT_CURRENT); if (($mtc_pg = $this->query($mtc_sql)) == FALSE || pg_affected_rows($mtc_pg) != 1) { log_crit(sprintf("bin5_points_save: failed at insert match [%s]", $mtc_sql)); break;