+ case (Time.now - last_modified)/60 # minutes
+ when (0..30) then player_decoration = "current"
+ when (0..(1*60*24)) then player_decoration = "today"
+ when (0..(7*60*24)) 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
+
+ rate = yaml[key]['rate']
+ top_rate ||= rate
+ diff_rate = rate - top_rate
+ diff_possibility = 1.0/(1.0 + 10**(-diff_rate/400.0))
+ %>
+ <tr class="<%=player_decoration%>">
+ <td class="name">
+ <a id="popup<%=popup_id+=1%>" href="http://wdoor.c.u-tokyo.ac.jp/shogi/tools/view/show-player.cgi?event=LATEST&filter=floodgate&show_self_play=1&user=<%=u key%>"><%= h yaml[key]['name'] %></a>
+ <script type="text/javascript">
+ var tooltip<%=popup_id%> = new YAHOO.widget.Tooltip("myTooltip", {
+ context:"popup<%=popup_id%>",
+ text:"<%= h key %>" } );
+ </script>
+ </td>
+ <td class="rate">
+ <span id="popup<%=popup_id+=1%>"><%= rate != 0 ? "%5d" % [ rate ] : "N/A" %></span>
+ <script type="text/javascript">
+ var tooltip<%=popup_id%> = new YAHOO.widget.Tooltip("myTooltip", {
+ context:"popup<%=popup_id%>",
+ text:"Behind <%= "%5d" % [ diff_rate ] %> (<%= "%.3f" % [ diff_possibility ] %>)" } );
+ </script>
+ </td>
+ <td class="ngames">
+ <%= "%5d" % [ win ] %> </td>
+ <td class="ngames">
+ <%= "%5d" % [ loss ] %> </td>
+ <td class="win_rate">
+ <%= "%.3f" % [win_rate] %> </td>
+ <td class="last_modified">
+ <%= show_date(last_modified) %> </td>
+% if $wdoor
+ <td class="rate">
+ <%= rate != 0 && yss_rate > 0 ? ("%5d" % [2300 - yss_rate + rate]) : "N/A" %> </td>
+% end
+ </tr>
+% end
+ENDTABLE
+
+ tables << table.result(binding)
+ end