From: Matteo Nastasi (mop) Date: Sun, 9 Aug 2009 09:02:41 +0000 (+0000) Subject: change of the placings calculation X-Git-Tag: 3.0.0~41 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=bf073fd0ae276622564ef5404ddd182177901e6b;p=brisk.git change of the placings calculation --- diff --git a/web/briskin5/Obj/placing.phh b/web/briskin5/Obj/placing.phh index d0ce4b9..583fce7 100644 --- a/web/briskin5/Obj/placing.phh +++ b/web/briskin5/Obj/placing.phh @@ -27,16 +27,16 @@ define(TOP_NUM, 10); define(TRI_LIMIT, (90 * 24 * 60 * 60)); -// define(TRI_FEW_GAMES, 60); -define(TRI_FEW_GAMES, 140); +define(TRI_MIN_GAMES, 70); +define(TRI_MAX_GAMES, 140); define(MON_LIMIT, (30 * 24 * 60 * 60)); -// define(MON_FEW_GAMES, 20); -define(MON_FEW_GAMES, 70); +define(MON_MIN_GAMES, 35); +define(MON_MAX_GAMES, 70); define(WEE_LIMIT, (7 * 24 * 60 * 60)); -// define(WEE_FEW_GAMES, 10); -define(WEE_FEW_GAMES, 35); +define(WEE_MIN_GAMES, 10); +define(WEE_MAX_GAMES, 35); class Ptsgam { @@ -51,7 +51,7 @@ class Ptsgam { $this->gam = $gam; } - function &clone() + function &myclone() { $ret = new Ptsgam($this->username, $this->pts, $this->gam); @@ -99,21 +99,44 @@ function ptsgam_cmp($a, $b) function placings_show(&$user) { - $ret = sprintf("
"); - $ret .= sprintf("", WEE_FEW_GAMES, placing_show($user, "wee_hi") ); - $ret .= sprintf("\n", WEE_FEW_GAMES, placing_show($user, "wee_lo") ); + $mtime = placing_time(); + $tm = placing_date($mtime); + $ret = sprintf("

CLASSIFICHE

(aggiornate alle ore %s del %s)

Settimanale
(non meno di %d partite)

%s

Settimanale
(meno di %d partite)

%s
", $tm[0], $tm[1]); - $ret .= sprintf("", MON_FEW_GAMES, placing_show($user, "mon_hi") ); - $ret .= sprintf("\n", MON_FEW_GAMES, placing_show($user, "mon_lo") ); + $tmwee = placing_date($mtime - WEE_LIMIT + (3600)); + $ret .= sprintf("", $tmwee[1], $tm[1], WEE_MAX_GAMES, placing_show($user, "wee_hi") ); + $ret .= sprintf("\n", $tmwee[1], $tm[1], WEE_MAX_GAMES, WEE_MIN_GAMES, placing_show($user, "wee_lo") ); - $ret .= sprintf("", TRI_FEW_GAMES, placing_show($user, "tri_hi")); - $ret .= sprintf("", TRI_FEW_GAMES, placing_show($user, "tri_lo")); + $tmmon = placing_date($mtime - MON_LIMIT + (3600)); + $ret .= sprintf("", $tmmon[1], $tm[1], MON_MAX_GAMES, placing_show($user, "mon_hi") ); + $ret .= sprintf("\n", $tmmon[1], $tm[1], MON_MAX_GAMES, MON_MIN_GAMES, placing_show($user, "mon_lo") ); + + $tmtri = placing_date($mtime - TRI_LIMIT + (3600)); + $ret .= sprintf("", $tmtri[1], $tm[1], TRI_MAX_GAMES, placing_show($user, "tri_hi")); + $ret .= sprintf("", $tmtri[1], $tm[1], TRI_MAX_GAMES, TRI_MIN_GAMES, placing_show($user, "tri_lo")); $ret .= sprintf("

Mensile
(non meno di %d partite)

%s

Mensile
(meno di %d partite)

%s

Settimanale
dal %s al %s
(non meno di %d partite)

%s

Settimanale
dal %s al %s
(meno di %d partite, più di %d)

%s

Trimestrale
(non meno di %d partite)

%s

Trimestrale
(meno di %d partite)

%s

Mensile
dal %s al %s
(non meno di %d partite)

%s

Mensile
dal %s al %s
(meno di %d partite, più di %d)

%s

Trimestrale
dal %s al %s
(non meno di %d partite)

%s

Trimestrale
dal %s al %s
(meno di %d partite, più di %d)

%s
"); return ($ret); } +function placing_time() +{ + if (($fp = @fopen(LEGAL_PATH."/class_wee_lo.log", 'r')) == FALSE) { + return (FALSE); + } + $st = fstat($fp); + fclose($fp); + + return ( $st['mtime'] ); +} + +function placing_date($mtime) +{ + return array( date('G:i', $mtime), date('j/n/y', $mtime) ); +} + + function placing_show(&$user, $suff) { $tail = FALSE; @@ -141,13 +164,13 @@ function placing_show(&$user, $suff) if ($i < TOP_NUM) { $ret .= sprintf("%d%s%s%s%s(%d/%d)", $i+1, - ($pg->username == $user->name ? "" : ""), $pg->username, ($pg->username == $user->name ? "" : ""), $pg->snormpts(), $pg->pts, $pg->gam); + ($pg->username == $user->name ? "" : ""), xcape($pg->username), ($pg->username == $user->name ? "" : ""), $pg->snormpts(), $pg->pts, $pg->gam); } if ($user != FALSE) { if (strcasecmp($pg->username, $user->name) == 0 && $i >= TOP_NUM) { $tail = sprintf(" . . . . . . . . . . "); $tail .= sprintf("%d%s%s%s%s(%d/%d)", $i+1, - ($pg->username == $user->name ? "" : ""), $pg->username, ($pg->username == $user->name ? "" : ""), $pg->snormpts(), $pg->pts, $pg->gam); + ($pg->username == $user->name ? "" : ""), xcape($pg->username), ($pg->username == $user->name ? "" : ""), $pg->snormpts(), $pg->pts, $pg->gam); } } $old_normpts = $pg->normpts(); diff --git a/web/briskin5/statadm.php b/web/briskin5/statadm.php index fda759e..abe0042 100644 --- a/web/briskin5/statadm.php +++ b/web/briskin5/statadm.php @@ -126,10 +126,10 @@ function main() if ($tri[$i]->gam == 0.0) continue; printf("%s: %s (%d)
\n", $tri[$i]->username, $tri[$i]->snormpts(), $tri[$i]->gam); - if ($tri[$i]->gam < TRI_FEW_GAMES) - fwrite($fplo, sprintf("%s|%d|%d|\n", xcapelt($tri[$i]->username), $tri[$i]->pts, $tri[$i]->gam)); - else + if ($tri[$i]->gam >= TRI_MAX_GAMES) fwrite($fphi, sprintf("%s|%d|%d|\n", xcapelt($tri[$i]->username), $tri[$i]->pts, $tri[$i]->gam)); + else if ($tri[$i]->gam > TRI_MIN_GAMES) + fwrite($fplo, sprintf("%s|%d|%d|\n", xcapelt($tri[$i]->username), $tri[$i]->pts, $tri[$i]->gam)); } fclose($fphi); fclose($fplo); @@ -149,10 +149,10 @@ function main() if ($mon[$i]->gam == 0.0) continue; printf("%s: %s (%d)
\n", $mon[$i]->username, $mon[$i]->snormpts(), $mon[$i]->gam); - if ($mon[$i]->gam < MON_FEW_GAMES) - fwrite($fplo, sprintf("%s|%d|%d|\n", xcapelt($mon[$i]->username), $mon[$i]->pts, $mon[$i]->gam)); - else + if ($mon[$i]->gam >= MON_MAX_GAMES) fwrite($fphi, sprintf("%s|%d|%d|\n", xcapelt($mon[$i]->username), $mon[$i]->pts, $mon[$i]->gam)); + else if ($mon[$i]->gam > MON_MIN_GAMES) + fwrite($fplo, sprintf("%s|%d|%d|\n", xcapelt($mon[$i]->username), $mon[$i]->pts, $mon[$i]->gam)); } fclose($fphi); fclose($fplo); @@ -171,10 +171,10 @@ function main() if ($wee[$i]->gam == 0.0) continue; printf("%s: %s (%d)
\n", $wee[$i]->username, $wee[$i]->snormpts(), $wee[$i]->gam); - if ($wee[$i]->gam < WEE_FEW_GAMES) - fwrite($fplo, sprintf("%s|%d|%d|\n", xcapelt($wee[$i]->username), $wee[$i]->pts, $wee[$i]->gam)); - else + if ($wee[$i]->gam >= WEE_MAX_GAMES) fwrite($fphi, sprintf("%s|%d|%d|\n", xcapelt($wee[$i]->username), $wee[$i]->pts, $wee[$i]->gam)); + else if ($wee[$i]->gam > WEE_MIN_GAMES) + fwrite($fplo, sprintf("%s|%d|%d|\n", xcapelt($wee[$i]->username), $wee[$i]->pts, $wee[$i]->gam)); } fclose($fphi); fclose($fplo);