Changed getLockedBalance and added SQL
* New SQL file for upgrade includes next changes * Properly calculate getLockedBalance based on shares Further addresses #70
This commit is contained in:
parent
ae0252d927
commit
31de069533
@ -143,8 +143,11 @@ class Transaction {
|
||||
SELECT sum(t.amount) AS credit
|
||||
FROM $this->table AS t
|
||||
LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id
|
||||
WHERE t.type IN ('Credit', 'Credit_PPS')
|
||||
AND b.confirmations >= " . $this->config['confirmations'] . "
|
||||
WHERE
|
||||
(
|
||||
( t.type = 'Credit' AND b.confirmations >= ? ) OR
|
||||
( t.type = 'Credit_PPS' )
|
||||
)
|
||||
) AS t1,
|
||||
(
|
||||
SELECT sum(t.amount) AS debit
|
||||
@ -155,10 +158,13 @@ class Transaction {
|
||||
SELECT sum(t.amount) AS other
|
||||
FROM " . $this->table . " AS t
|
||||
LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id
|
||||
WHERE t.type IN ('Donation','Fee','Donation_PPS','Fee_PPS')
|
||||
AND b.confirmations >= " . $this->config['confirmations'] . "
|
||||
WHERE
|
||||
(
|
||||
( t.type IN ('Donation','Fee') AND b.confirmations >= ? ) OR
|
||||
( t.type IN ('Donation_PPS', 'Fee_PPS') )
|
||||
)
|
||||
) AS t3");
|
||||
if ($this->checkStmt($stmt) && $stmt->execute() && $stmt->bind_result($dBalance) && $stmt->fetch())
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $this->config['confirmations'], $this->config['confirmations']) && $stmt->execute() && $stmt->bind_result($dBalance) && $stmt->fetch())
|
||||
return $dBalance;
|
||||
// Catchall
|
||||
$this->setErrorMessage('Unable to find locked credits for all users');
|
||||
|
||||
1
sql/issue_70_transactions_upgrade.sql
Normal file
1
sql/issue_70_transactions_upgrade.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `transactions` CHANGE `type` `type` ENUM( 'Credit', 'Debit_MP', 'Debit_AP', 'Donation', 'Fee', 'Orphan_Credit', 'Orphan_Fee', 'Orphan_Donation', 'Bonus', 'Orphan_Bonus', 'Credit_PPS', 'Debit_PPS', 'Donation_PPS' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
|
||||
Loading…
Reference in New Issue
Block a user