Chainquery integration #49
3 changed files with 12 additions and 7 deletions
|
@ -220,7 +220,15 @@ class MainController extends AppController {
|
||||||
$blocks[$i]->transaction_count = count($tx_hashes);
|
$blocks[$i]->transaction_count = count($tx_hashes);
|
||||||
}
|
}
|
||||||
|
|
||||||
$transactions = $this->Transactions->find()->select(['Transactions.id', 'Transactions.hash', 'Transactions.input_count', 'Transactions.output_count', 'Transactions.transaction_time', 'Transactions.created_at'])->select(['value' => 'sum(O.value)'])->leftJoin(['O' => 'output'], ['O.transaction_id = Transactions.id'])->order(['Transactions.created_at' => 'desc'])->limit(10)->toArray();
|
$transactions = $this->Transactions->find()->select(['Transactions.id', 'Transactions.hash', 'Transactions.input_count', 'Transactions.output_count', 'Transactions.transaction_time', 'Transactions.created_at'])->order(['Transactions.created_at' => 'desc'])->limit(10)->toArray();
|
||||||
|
foreach($transactions as $tx) {
|
||||||
|
$value = 0;
|
||||||
|
$outputs = $this->Outputs->find()->where(['transaction_id' => $tx->id])->toArray();
|
||||||
|
foreach($outputs as $output) {
|
||||||
|
$value += $output->value;
|
||||||
|
}
|
||||||
|
$tx->value = $value;
|
||||||
|
}
|
||||||
|
|
||||||
$this->set('blocks', $blocks);
|
$this->set('blocks', $blocks);
|
||||||
$this->set('txs', $transactions);
|
$this->set('txs', $transactions);
|
||||||
|
|
|
@ -8,11 +8,8 @@ use Cake\ORM\TableRegistry;
|
||||||
class Claim extends Entity {
|
class Claim extends Entity {
|
||||||
function getLbryLink() {
|
function getLbryLink() {
|
||||||
$link = $this->name;
|
$link = $this->name;
|
||||||
$ClaimModel = TableRegistry::get('Claims');
|
if (isset($this->publisher)) {
|
||||||
$publisher = $ClaimModel->find()->select(['name'])->where(['claim_id' => $this->publisher_id])->first();
|
$link = $this->publisher . '/' . $link;
|
||||||
|
|
||||||
if (isset($publisher->name)) {
|
|
||||||
$link = $publisher->name . '/' . $link;
|
|
||||||
}
|
}
|
||||||
$link = 'lbry://' . $link;
|
$link = 'lbry://' . $link;
|
||||||
return $link;
|
return $link;
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($txs as $tx): ?>
|
<?php foreach ($txs as $tx): ?>
|
||||||
<tr data-hash="<?php echo $tx->Hash ?>" data-time="<?php echo $tx->transaction_time ?>">
|
<tr data-hash="<?php echo $tx->hash ?>" data-time="<?php echo $tx->transaction_time ?>">
|
||||||
<td class="w200"><div><a href="/tx/<?php echo $tx->hash ?>" target="_blank"><?php echo $tx->hash ?></a></div></td>
|
<td class="w200"><div><a href="/tx/<?php echo $tx->hash ?>" target="_blank"><?php echo $tx->hash ?></a></div></td>
|
||||||
<td><?php echo $tx->created_at->diffForHumans(); ?></td>
|
<td><?php echo $tx->created_at->diffForHumans(); ?></td>
|
||||||
<td class="right"><?php echo $tx->input_count ?></td>
|
<td class="right"><?php echo $tx->input_count ?></td>
|
||||||
|
|
Loading…
Reference in a new issue