Fix displayed pending amount in user wallet

There was a (UI only) difference between details and total.

note: the paid amount was correct (the one showed in show details)
This commit is contained in:
Tanguy Pruvot 2016-05-03 13:40:16 +02:00
parent b82873632b
commit 382131c413
3 changed files with 25 additions and 17 deletions

View file

@ -39,6 +39,13 @@ function getMarketUrl($coin, $marketName)
$parts = explode(' ',$marketName); $parts = explode(' ',$marketName);
$market = $parts[0]; $market = $parts[0];
$base = $parts[1]; $base = $parts[1];
if (empty($base)) {
debuglog("warning: invalid market name '$marketName'");
$base = dboscalar(
"SELECT base_coin FROM markets WHERE coinid=:id AND name=:name", array(
':id'=>$coin->id, ':name'=>$marketName,
));
}
} }
$lowbase = strtolower($base); $lowbase = strtolower($base);

View file

@ -293,12 +293,12 @@ function yaamp_convert_earnings_user($user, $status)
$value = 0.; $value = 0.;
if (YAAMP_ALLOW_EXCHANGE) { if (YAAMP_ALLOW_EXCHANGE) {
if(!$refcoin) $refcoin = getdbosql('db_coins', "symbol='BTC'"); if(!$refcoin) $refcoin = getdbosql('db_coins', "symbol='BTC'");
if(!$refcoin || $refcoin->price2 <= 0) return 0; if(!$refcoin || $refcoin->price <= 0) return 0;
$value = dboscalar("SELECT sum(amount*price) FROM earnings WHERE $status AND userid={$user->id}"); $value = dboscalar("SELECT sum(amount*price) FROM earnings WHERE $status AND userid={$user->id}");
$value = $value / $refcoin->price2; $value = $value / $refcoin->price;
} else if ($refcoin && $refcoin->price2 > 0.) { } else if ($refcoin && $refcoin->price > 0.) {
$value = dboscalar("SELECT sum(amount*price) FROM earnings WHERE $status AND userid={$user->id}"); $value = dboscalar("SELECT sum(amount*price) FROM earnings WHERE $status AND userid={$user->id}");
$value = $value / $refcoin->price2; $value = $value / $refcoin->price;
} else if ($user->coinid) { } else if ($user->coinid) {
$value = dboscalar("SELECT sum(amount) FROM earnings WHERE $status AND userid={$user->id} AND coinid=".$user->coinid); $value = dboscalar("SELECT sum(amount) FROM earnings WHERE $status AND userid={$user->id} AND coinid=".$user->coinid);
} }

View file

@ -116,30 +116,31 @@ $total_pending = bitcoinvaluetoa($total_pending);
if(!$show_details && $total_unsold > 0) if(!$show_details && $total_unsold > 0)
{ {
echo "<tr><td colspan=6 align=right> echo '
<label style='font-size: .8em;'> <tr><td colspan="6" align="right">
<input type='checkbox' onclick='javascript:main_wallet_refresh_details()'> <label style="font-size: .8em;">
<input type="checkbox" onclick="javascript:main_wallet_refresh_details()">
Show Details Show Details
</label> </label>
</td></tr>"; </td></tr>';
} }
echo "<tr class='ssrow' style='border-top: 3px solid #eee;'>"; echo '<tr class="ssrow" style="border-top: 3px solid #eee;">';
echo "<td valign=top><img width=16 src='$refcoin->image'></td>"; echo '<td valign="top"><img width="16" src="'.$refcoin->image.'"></td>';
echo "<td valign=top><b>"; echo '<td valign="top"><b>';
if($refcoin->symbol == 'BTC') if($refcoin->symbol == 'BTC')
echo "$refcoin->name"; echo $refcoin->name;
else else
echo "<a href='/site/block?id={$refcoin->id}'>$refcoin->name</a>"; echo '<a href="/site/block?id='.$refcoin->id.'">'.$refcoin->name.'</a>';
echo '<br/><span style="font-size: .8em;"">(total pending)</span></b></td>'; echo '<br/><span style="font-size: .8em;"">(total pending)</span></b></td>';
echo "<td valign=top align=right style='font-size: .8em;'>$unconfirmed</td>"; echo '<td valign="top" align="right" style="font-size: .8em;">'.$unconfirmed.'</td>';
echo "<td valign=top align=right style='font-size: .8em;'>$confirmed</td>"; echo '<td valign="top" align="right" style="font-size: .8em;">'.$confirmed.'</td>';
echo "<td valign=top align=right style='font-size: .8em;'></td>"; echo '<td valign="top" align="right" style="font-size: .8em;"></td>';
echo "<td valign=top align=right style='font-size: .8em;'>$total_unsold $refcoin->symbol</td>"; echo '<td valign="top" align="right" style="font-size: .8em;">'.$total_unsold.' '.$refcoin->symbol.'</td>';
echo "</tr>"; echo "</tr>";