Chainquery integration #49

Merged
marcdeb1 merged 44 commits from chainquery into master 2019-02-13 19:01:13 +01:00
3 changed files with 12 additions and 7 deletions
Showing only changes of commit 9d88e2eaec - Show all commits

View file

@ -220,7 +220,15 @@ class MainController extends AppController {
$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('txs', $transactions);

View file

@ -8,11 +8,8 @@ use Cake\ORM\TableRegistry;
class Claim extends Entity {
function getLbryLink() {
$link = $this->name;
$ClaimModel = TableRegistry::get('Claims');
$publisher = $ClaimModel->find()->select(['name'])->where(['claim_id' => $this->publisher_id])->first();
if (isset($publisher->name)) {
$link = $publisher->name . '/' . $link;
if (isset($this->publisher)) {
$link = $this->publisher . '/' . $link;
}
$link = 'lbry://' . $link;
return $link;

View file

@ -153,7 +153,7 @@
<tbody>
<?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><?php echo $tx->created_at->diffForHumans(); ?></td>
<td class="right"><?php echo $tx->input_count ?></td>