Permalink
Browse files

Merge pull request #17 from eosdac/update_account_data

Include is_member and has_voted on the holders table along with some account updates.
  • Loading branch information...
piecesnbits committed Jan 23, 2019
2 parents f46a928 + b8df3a9 commit 570d9b4b70180375a7f0270bc0d78c6662e5724f
Showing with 47 additions and 17 deletions.
  1. +1 −1 api/explorer_base_api.php
  2. +7 −7 api/explorer_table_api.php
  3. +3 −1 deamon/sql.txt
  4. +22 −6 frontend/src/pages/account.vue
  5. +14 −2 frontend/src/pages/hodlers.vue
@@ -35,7 +35,7 @@
switch ($_GET['chart']) {
case 'topholders':
$stmt = $conn->prepare('SELECT account,balance FROM balances WHERE balance > 0 ORDER BY balance DESC LIMIT 500');
$stmt = $conn->prepare('SELECT account,balance,is_member,has_voted FROM balances WHERE balance > 0 ORDER BY balance DESC LIMIT 500');
break;
case 'tokenactivity':
$where = isset($_GET['account']) ? 'AND _from ="'.$_GET['account'].'" OR _to ="'.$_GET['account'].'"' : '';
@@ -27,18 +27,18 @@
break;
case 'hodlers':
$dt->query('SELECT account,balance, @curRank := @curRank + 1 AS rank FROM balances p, (SELECT @curRank := 0) r WHERE balance > 0 ORDER BY balance DESC');
$dt->query('SELECT account,balance,is_member,has_voted, @curRank := @curRank + 1 AS rank FROM balances p, (SELECT @curRank := 0) r WHERE balance > 0 ORDER BY balance DESC');
// $dt->query('SELECT account, balance FROM balances WHERE balance > 0');
break;
case 'transfers':
$dt->query('SELECT account_action_seq, _from, _to, _quantity, _symbol, _memo, txid, block_num, block_time FROM transfers ORDER BY account_action_seq DESC');
$dt->query('SELECT account_action_seq, _from, _to, _quantity, _symbol, _memo, txid, block_num, block_time FROM transfers ORDER BY account_action_seq DESC');
break;
case 'accounttransfers':
if (isset($_GET['account'])) {
$account = $_GET['account'];
// echo $account;
$dt->query('SELECT `account_action_seq`,`_from`,`_to`,`_quantity`,`_symbol`,`_memo`,`txid`,`block_num`,`block_time` FROM transfers WHERE _from="'.$account.'" OR _to="'.$account.'" ');
}
if (isset($_GET['account'])) {
$account = $_GET['account'];
// echo $account;
$dt->query('SELECT `account_action_seq`,`_from`,`_to`,`_quantity`,`_symbol`,`_memo`,`txid`,`block_num`,`block_time` FROM transfers WHERE _from="'.$account.'" OR _to="'.$account.'" ');
}
break;
}
}
@@ -16,10 +16,12 @@ CREATE TABLE `transfers` (
CREATE TABLE `balances` (
`account` varchar(256) NOT NULL,
`balance` decimal(13,4) DEFAULT NULL,
`is_member` tinyint(1) DEFAULT 0 NOT NULL,
`has_voted` tinyint(1) DEFAULT 0 NOT NULL,
`is_exchange` tinyint(1) DEFAULT 0 NOT NULL,
PRIMARY KEY (`account`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1


delimiter $$
$$
CREATE TRIGGER update_balance_table AFTER INSERT ON eosdac_explorer.transfers
@@ -48,14 +48,9 @@
<q-icon class="q-ma-sm text-mywhite2" style="font-size:45px;" name="icon-item-06"></q-icon>
</div>
<div class="col-xs-4 text-left">
<p class="q-mb-none q-mt-sm q-headline text-weight-light text-white big" style="line-height:24px;">0</p>
<p class="q-mb-none q-mt-sm q-headline text-weight-light text-white big" style="line-height:24px;">{{votes}}</p>
<span class="q-subheading">{{ $t('VOTES') }}</span>
</div>
<div class="col-xs-5 relative-position">

<p class="small q-mb-xs absolute" style="bottom:0;right:10px;">Coming Soon</p>
</div>

</div>
</div>
</div>
@@ -193,6 +188,7 @@ export default {
ismember: false,
eosdacbalance:0,
eosbalance:0,
votes:0,
filter: '',
loading: false,
serverPagination: {
@@ -223,6 +219,24 @@ export default {
},
getVotes(){
this.$eos.getTableRows({json: "true", scope: "daccustodian", code: "daccustodian", table: "votes", lower_bound: this.title, limit:1}).then(res =>{
if(!res.rows.length){
this.votes = 0;
return false;
}
else{
if (res.rows[0].voter === this.title){
this.votes = res.rows[0].candidates.length;
}
else{
this.votes = 0;
}
}
}).catch(e => {
this.$q.notify({message:this.$t('error_node_member'), color:'negative'});
})
},
getBalances(){
this.$eos.getCurrencyBalance({account: this.title, code: "eosdactokens", symbol: "EOSDAC"}).then(x=>{
if(x.length !=0){
@@ -302,6 +316,7 @@ export default {
});
this.getBalances();
this.getMemberStatus();
this.getVotes();
},
watch: {
@@ -313,6 +328,7 @@ watch: {
});
this.getBalances();
this.getMemberStatus();
this.getVotes();
}
},
@@ -21,10 +21,20 @@
<router-link :to="{path: '/account/' + props.value}" >{{ props.value }}</router-link>
</q-td>

<q-td slot="body-cell-balance" slot-scope="props" :props="props" :style="{width:'80%'}">
<q-td slot="body-cell-balance" slot-scope="props" :props="props">
{{ props.value }}
</q-td>

<q-td slot="body-cell-is_member" slot-scope="props" :props="props">
<span v-if="props.value == 1">Yes</span>
<span v-if="props.value == 0">No</span>
</q-td>

<q-td slot="body-cell-has_voted" slot-scope="props" :props="props" :style="{width:'80%'}">
<span v-if="props.value == 1">Yes</span>
<span v-if="props.value == 0">No</span>
</q-td>

<template slot="top-right" slot-scope="props">
<q-search hide-underline v-model.trim="filter" />
<q-btn
@@ -77,7 +87,9 @@ export default {
columns: [
{ name: 'rank', label: '', field: 'rank', align: 'center', ignoreapi:true},
{ name: 'account', label: this.$t('account'), field: 'account', align: 'center', searchable:true},
{ name: 'balance', label: 'EOSDAC', field: 'balance' , align: 'left'}
{ name: 'balance', label: 'EOSDAC', field: 'balance' , align: 'left'},
{ name: 'is_member', label: 'Is Member?', field: 'is_member' , align: 'center'},
{ name: 'has_voted', label: 'Has Voted?', field: 'has_voted' , align: 'center'}
]
}
},

0 comments on commit 570d9b4

Please sign in to comment.