From: beatles Date: Sat, 17 Feb 2007 14:34:02 +0000 (+0000) Subject: - Show groups in the order specified in players.html. X-Git-Tag: 20170902~340 X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=2cfcbcfce6fc6d31fd5f4f180669c692750f3a2a;p=shogi-server%2Fshogi-server.git - Show groups in the order specified in players.html. - Players who gamed recently have a background color. --- diff --git a/changelog b/changelog index 23ba547..13b3c4f 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,11 @@ +2007-02-18 Daigo Moriwaki + + * [mk_html] + - Show groups in the order specified in players.html. + - Players who gamed recently have a background color. + * [mk_rate] + - Implemented half-life effect. Numbers of win/lose decrease by this effect. + 2006-11-26 Daigo Moriwaki * [shogi-server] Sente (gote) was able to move gote's (sente's) hand. diff --git a/mk_html b/mk_html index 62ef828..861ac1f 100755 --- a/mk_html +++ b/mk_html @@ -49,8 +49,8 @@ def main erb = ERB.new( DATA.read, nil, "%>" ) tables = [] - file["players"].each do |key, yaml| - sorted_keys = yaml.keys.sort {|a,b| yaml[b]['rate'] <=> yaml[a]['rate']} + file["players"].sort.each do |key, yaml| # sort groups in the order written in players.yaml + sorted_keys = yaml.keys.sort {|a,b| yaml[b]['rate'] <=> yaml[a]['rate']} # sort players in a group by one's rate table = ERB.new(<") % sorted_keys.each do |key| @@ -59,8 +59,20 @@ def main loss = yaml[key]['loss'] win_rate = win.to_f / (win + loss) last_modified = yaml[key]['last_modified'] + + player_decoration = "default" + + case (Time.now - last_modified)/(60*60*24) + when (0..1) then player_decoration = "today" + when (0..7) then player_decoration = "this_week" + end + + case key + when "yowai_gps+95908f6c18338f5340371f71523fc5e3" then player_decoration = "yowai_gps" + when "gps+11648e4e66e7ed6a86cb7f1d0cf604fe" then player_decoration = "gps" + end %> - + <%= h yaml[key]['name'] %> <%= "%5d" % [ yaml[key]['rate'] ] %> <%= "%5d" % [ win ] %> @@ -95,15 +107,20 @@ __END__ TABLE {margin-left: auto; margin-right: auto; border-collapse: collapse; - border: solid 2px;} + border: solid 2px; + width: 500px;} CAPTION { caption-side: left;} TH {border: solid 1px;} TD {padding-left: 10px; padding-right: 10px; border: solid 1px;} - .name {text-align: center;} + .name {text-align: center; + width: 180px;} .rate, .ngames, .win_rate {text-align: right;} .last_modified {text-align: left;} + .gps, .yowai_gps {background-color: lightgreen;} + .today {background-color: #FFD700;} + .this_week {background-color: #FFDAB9;} DIV.footer {text-align: right; font-size: 80%;}