Browse Source

php - display the 'recent worker' stats on the workers page

master
kanoi 10 years ago
parent
commit
0b81e03650
  1. 19
      pool/page_workers.php

19
pool/page_workers.php

@ -22,7 +22,8 @@ function workhashorder($a, $b)
# #
function workuser($data, $user, &$offset, &$totshare, &$totdiff, function workuser($data, $user, &$offset, &$totshare, &$totdiff,
&$totinvalid, &$totrate, &$blockacc, &$totinvalid, &$totrate, &$blockacc,
&$blockreward, $old = false, $srt = false) &$blockreward, $old = false, $srt = false,
$one = false, &$title)
{ {
$ans = getWorkers($user); $ans = getWorkers($user);
@ -33,6 +34,13 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
$blockacc = $ans['blockacc']; $blockacc = $ans['blockacc'];
if (isset($ans['blockreward'])) if (isset($ans['blockreward']))
$blockreward = $ans['blockreward']; $blockreward = $ans['blockreward'];
if ($one === true && isset($ans['oldworkers']))
{
$days = intval($ans['oldworkers']);
if ($days != 0)
$title = ' (last '.$days.' day'.
(($days==1)?'':'s').')';
}
$all = array(); $all = array();
$count = $ans['rows']; $count = $ans['rows'];
for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++)
@ -151,9 +159,9 @@ function worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate, $blockac
# #
function doworker($data, $user) function doworker($data, $user)
{ {
$pg = '<h1>Workers</h1>'; $title = '';
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n"; $pg = "<table callpadding=0 cellspacing=0 border=0>\n";
$totshare = 0; $totshare = 0;
$totdiff = 0; $totdiff = 0;
@ -165,7 +173,8 @@ function doworker($data, $user)
$pg .= worktitle($data, $user); $pg .= worktitle($data, $user);
$pg .= workuser($data, $user, $offset, $totshare, $totdiff, $totinvalid, $pg .= workuser($data, $user, $offset, $totshare, $totdiff, $totinvalid,
$totrate, $blockacc, $blockreward, false, true); $totrate, $blockacc, $blockreward, false, true, true,
$title);
$pg .= worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate, $pg .= worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate,
$blockacc, $blockreward); $blockacc, $blockreward);
@ -179,7 +188,7 @@ function doworker($data, $user)
$pg .= "</table>\n"; $pg .= "</table>\n";
return $pg; return "<h1>Workers$title</h1>".$pg;
} }
# #
function doworkers($data, $user) function doworkers($data, $user)

Loading…
Cancel
Save