[IMPROVED] Proportional payout log format

This commit is contained in:
Sebastian Grewe 2014-02-15 17:10:45 +01:00
parent aab216e117
commit 950e607230

View File

@ -40,7 +40,8 @@ if (empty($aAllBlocks)) {
$count = 0; $count = 0;
// Table header for account shares // Table header for account shares
$log->logInfo("ID\tUsername\tValid\tInvalid\tPercentage\tPayout\t\tDonation\tFee"); $strLogMask = "| %5.5s | %-15.15s | %15.15s | %15.15s | %12.12s | %20.20s | %20.20s | %20.20s |";
$log->logInfo(sprintf($strLogMask, 'ID', 'Username', 'Valid', 'Invalid', 'Percentage', 'Payout', 'Donation', 'Fee'));
foreach ($aAllBlocks as $iIndex => $aBlock) { foreach ($aAllBlocks as $iIndex => $aBlock) {
// If we have unaccounted blocks without share_ids, they might not have been inserted yet // If we have unaccounted blocks without share_ids, they might not have been inserted yet
if (!$aBlock['share_id']) { if (!$aBlock['share_id']) {
@ -94,14 +95,10 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8); $aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8);
// Verbose output of this users calculations // Verbose output of this users calculations
$log->logInfo($aData['id'] . "\t" . $log->logInfo(
$aData['username'] . "\t" . sprintf($strLogMask, $aData['id'], $aData['username'], $aData['valid'], $aData['invalid'],
$aData['valid'] . "\t" . number_format($aData['percentage'], 8), number_format($aData['payout'], 8), number_format($aData['donation'], 8), number_format($aData['fee'], 8))
$aData['invalid'] . "\t" . );
number_format($aData['percentage'], 8) . "\t" .
number_format($aData['payout'], 8) . "\t" .
number_format($aData['donation'], 8) . "\t" .
number_format($aData['fee'], 8));
// Update user share statistics // Update user share statistics
if (!$statistics->updateShareStatistics($aData, $aBlock['id'])) if (!$statistics->updateShareStatistics($aData, $aBlock['id']))