pool/web/yaamp/modules/stats/graph_results_5.php
Tanguy Pruvot bb31cec957 dos2unix all files, we are on linux
trim them, btw... its important to start on a clean base...
2015-07-12 04:40:50 +02:00

33 lines
486 B
PHP

<?php
$algo = user()->getState('yaamp-algo');
$s = 4*60*60;
$t = time() - 7*24*60*60;
$stats = getdbolist('db_hashstats', "time>$t and algo=:algo", array(':algo'=>$algo));
$res = array();
$first = 0;
foreach($stats as $n)
{
$i = floor($n->time/$s)*$s;
if(!$first) $first = $i;
if(!isset($res[$i]))
$res[$i] = 0;
$res[$i] += $n->earnings*8;
}
echo '[';
foreach($res as $i=>$n)
{
if($i != $first) echo ',';
$d = date('Y-m-d H:i:s', $i);
echo "[\"$d\",$n]";
}
echo ']';