mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=3477
This commit is contained in:
parent
ec78e50fb6
commit
c5b4118a34
|
@ -12838,3 +12838,20 @@ David May 30 2004
|
|||
sched/
|
||||
handle_request.C
|
||||
sched_send.C
|
||||
|
||||
David May 30 2004
|
||||
- Add the ability to sort by total or expavg credit in most lists
|
||||
- Fix the "update credit" feature to use the same
|
||||
formula used to compute expavg credit in the first place
|
||||
|
||||
html/
|
||||
inc/
|
||||
host.inc
|
||||
team.inc
|
||||
user.inc
|
||||
user/
|
||||
host_update_credit.php
|
||||
hosts_user.php
|
||||
top_hosts.php
|
||||
top_teams.php
|
||||
top_users.php
|
||||
|
|
|
@ -116,7 +116,9 @@ function show_host($host, $private, $ipprivate) {
|
|||
|
||||
}
|
||||
|
||||
function host_table_start($private, $show_owner) {
|
||||
// The following is used to show a user's hosts
|
||||
//
|
||||
function user_host_table_start($private) {
|
||||
start_table();
|
||||
echo "<tr>";
|
||||
echo "<th>Computer ID<br><font size=-2>Click for more info</font></th>\n";
|
||||
|
@ -125,9 +127,6 @@ function host_table_start($private, $show_owner) {
|
|||
";
|
||||
} else {
|
||||
echo "<th>Rank</th>";
|
||||
if ($show_owner) {
|
||||
echo "<th>Owner</th>\n";
|
||||
}
|
||||
}
|
||||
echo "
|
||||
<th>Recent average credit</th>
|
||||
|
@ -138,6 +137,32 @@ function host_table_start($private, $show_owner) {
|
|||
";
|
||||
}
|
||||
|
||||
// the following is used for list of top hosts
|
||||
//
|
||||
function top_host_table_start($sort_by) {
|
||||
start_table();
|
||||
echo "<tr>";
|
||||
echo "<th>Computer ID<br><font size=-2>Click for more info</font></th>\n";
|
||||
echo "<th>Rank</th>";
|
||||
echo "<th>Owner</th>\n";
|
||||
if ($sort_by == 'total_credit') {
|
||||
echo "
|
||||
<th><a href=top_hosts?sort_by=expavg_credit>Recent average credit</a></th>
|
||||
<th>Total credit</th>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<th>Recent average credit</th>
|
||||
<th><a href=top_hosts?sort_by=total_credit>Total credit</a></th>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<th>CPU type</th>
|
||||
<th>Operating system</th>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
function host_nresults($host) {
|
||||
$result = mysql_query("select count(*) as nresults from result where hostid=$host->id");
|
||||
$foobar = mysql_fetch_object($result);
|
||||
|
|
|
@ -104,13 +104,24 @@ function require_founder_login($user, $team) {
|
|||
}
|
||||
}
|
||||
|
||||
function team_table_start() {
|
||||
function team_table_start($sort_by) {
|
||||
echo "<tr>
|
||||
<th>Rank</th>
|
||||
<th>Name</th>
|
||||
<th>Members</th>
|
||||
<th><a href=top_teams.php?sort_by=expavg_credit>Recent average credit</a></th>
|
||||
<th><a href=top_teams.php?sort_by=total_credit>Total credit</a></th>
|
||||
";
|
||||
if ($sort_by == "total_credit") {
|
||||
echo "
|
||||
<th><a href=top_teams.php?sort_by=expavg_credit>Recent average credit</a></th>
|
||||
<th>Total credit</th>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<th>Recent average credit</th>
|
||||
<th><a href=top_teams.php?sort_by=total_credit>Total credit</a></th>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<th>Country</th>
|
||||
</tr>
|
||||
";
|
||||
|
|
|
@ -132,14 +132,25 @@ function show_user_page_private($user) {
|
|||
end_table();
|
||||
}
|
||||
|
||||
function user_table_start() {
|
||||
function user_table_start($sort_by) {
|
||||
start_table();
|
||||
echo "
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th>Name</th>
|
||||
<th><a href=top_users.php?sort_by=expavg_credit>Recent average credit</a></th>
|
||||
<th><a href=top_users.php?sort_by=total_credit>Total credit</a></th>
|
||||
";
|
||||
if ($sort_by == "total_credit") {
|
||||
echo "
|
||||
<th><a href=top_users.php?sort_by=expavg_credit>Recent average credit</a></th>
|
||||
<th>Total credit</th>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<th>Recent average credit</th>
|
||||
<th><a href=top_users.php?sort_by=total_credit>Total credit</a></th>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<th>Country</th>
|
||||
<th>Participant since</th>
|
||||
</tr>
|
||||
|
|
|
@ -24,20 +24,40 @@ function get_host($hostid, $user) {
|
|||
|
||||
$hostid = $_GET["hostid"];
|
||||
$latest_host = get_host($hostid, $user);
|
||||
$r = mysql_query("select * from result where hostid=$hostid");
|
||||
$r = mysql_query("select * from result where hostid=$hostid order by received_time");
|
||||
$t = 0;
|
||||
$a = 0;
|
||||
$avg = 0;
|
||||
$hl = 86400*7;
|
||||
$now = time();
|
||||
$avg_time = 0;
|
||||
$half_life = 86400*7;
|
||||
while ($result = mysql_fetch_object($r)) {
|
||||
if ($result->granted_credit <= 0) continue;
|
||||
$t += $result->granted_credit;
|
||||
$td = $now - $result->received_time;
|
||||
$a += $result->granted_credit*exp(-$td*M_LN2/$hl);
|
||||
|
||||
// the following taken from lib/util.C
|
||||
//
|
||||
if ($avg_time) {
|
||||
$diff = $result->received_time - $avg_time;
|
||||
if ($diff <=0) $diff = 3600;
|
||||
$diff_days = $diff/86400;
|
||||
$weight = exp(-$diff*M_LN2/$half_life);
|
||||
$avg *= $weight;
|
||||
$avg += (1-$weight)*($result->granted_credit/$diff_days);
|
||||
} else {
|
||||
$dd = ($result->received_time - $result->sent_time)/86400;
|
||||
$avg = $result->granted_credit/$dd;
|
||||
}
|
||||
$avg_time = $result->received_time;
|
||||
echo "<br>$avg\n";
|
||||
}
|
||||
$a /= 2; // not sure why this is needed
|
||||
mysql_free_result($r);
|
||||
mysql_query("update host set total_credit=$t, expavg_credit=$a where id=$hostid");
|
||||
echo "Host credit updated";
|
||||
|
||||
$diff = $now - $avg_time;
|
||||
$weight = exp(-$diff*M_LN2/$half_life);
|
||||
$avg *= $weight;
|
||||
mysql_query("update host set total_credit=$t, expavg_credit=$avg where id=$hostid");
|
||||
echo "<br>Host credit updated";
|
||||
page_tail();
|
||||
|
||||
?>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
mysql_free_result($result);
|
||||
if ($user->show_hosts) {
|
||||
page_head("Computers belonging to $user->name");
|
||||
host_table_start(false, false);
|
||||
user_host_table_start(false);
|
||||
} else {
|
||||
echo "Hidden\n";
|
||||
exit();
|
||||
|
@ -24,7 +24,7 @@
|
|||
$user = get_logged_in_user();
|
||||
$userid = $user->id;
|
||||
page_head("Your computers");
|
||||
host_table_start(true, false);
|
||||
user_host_table_start(true);
|
||||
$private = true;
|
||||
}
|
||||
$i = 1;
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
db_init();
|
||||
page_head("Top computers");
|
||||
if ($sort_by == "total_credit") {
|
||||
$sort_clause = "total_credit desc, total_credit desc";
|
||||
$sort_clause = "total_credit desc";
|
||||
} else {
|
||||
$sort_clause = "expavg_credit desc, total_credit desc";
|
||||
$sort_clause = "expavg_credit desc";
|
||||
}
|
||||
$result = mysql_query("select * from host order by $sort_clause limit $n offset $offset");
|
||||
host_table_start(false, true);
|
||||
top_host_table_start($sort_by);
|
||||
$i = $offset+1;
|
||||
while ($host = mysql_fetch_object($result)) {
|
||||
show_host_row($host, $i, false, true);
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
|
||||
page_head("Top teams");
|
||||
if ($sort_by == "total_credit") {
|
||||
$sort_by = "total_credit desc, total_credit desc";
|
||||
$sort_clause = "total_credit desc";
|
||||
} else {
|
||||
$sort_by = "expavg_credit desc, total_credit desc";
|
||||
$sort_clause = "expavg_credit desc";
|
||||
}
|
||||
$result = mysql_query("select * from team order by $sort_by");
|
||||
$result = mysql_query("select * from team order by $sort_clause");
|
||||
start_table();
|
||||
row1("Teams", 6);
|
||||
team_table_start();
|
||||
team_table_start($sort_by);
|
||||
$i = 1;
|
||||
while ($team = mysql_fetch_object($result)) {
|
||||
show_team_row($team, $i);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
$numusers = 100;
|
||||
page_head("Top $numusers participants");
|
||||
$result = mysql_query("select * from user order by $sort_order limit $numusers");
|
||||
user_table_start();
|
||||
user_table_start($sort_by);
|
||||
$i = 0;
|
||||
while ($user = mysql_fetch_object($result)) {
|
||||
show_user_row($user, ++$i);
|
||||
|
|
Loading…
Reference in New Issue