Skip to content

Commit

Permalink
update state to return proper vote info
Browse files Browse the repository at this point in the history
  • Loading branch information
revflash committed May 16, 2016
1 parent 271e077 commit 4ef97be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ vector<vote_state> database_api::get_active_votes( string author, string permlin
while( itr != idx.end() && itr->comment == cid )
{
const auto& vo = itr->voter(my->_db);
result.push_back(vote_state{vo.name,itr->weight});
result.push_back(vote_state{vo.name,itr->weight,itr->rshares,itr->vote_percent,itr->last_update});
++itr;
}
return result;
Expand All @@ -731,7 +731,7 @@ vector<account_vote> database_api::get_account_votes( string voter )const {
while( itr != end )
{
const auto& vo = itr->comment(my->_db);
result.push_back(account_vote{(vo.author+"/"+vo.permlink),itr->weight});
result.push_back(account_vote{(vo.author+"/"+vo.permlink),itr->weight,itr->rshares,itr->vote_percent, itr->last_update});
++itr;
}
return result;
Expand Down
14 changes: 10 additions & 4 deletions libraries/app/include/steemit/app/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ namespace steemit { namespace app {
struct vote_state {
string voter;
uint64_t weight;
int64_t rshares;
int16_t percent;
time_point_sec time;
};

struct account_vote {
string authorperm;
uint64_t weight;
string authorperm;
uint64_t weight;
int64_t rshares;
int16_t percent;
time_point_sec time;
};

struct discussion : public comment_object {
Expand Down Expand Up @@ -144,8 +150,8 @@ FC_REFLECT_DERIVED( steemit::app::extended_account,
(transfer_history)(market_history)(post_history)(vote_history)(other_history)(witness_votes)(posts)(blog)(recent_replies)(blog_category) )


FC_REFLECT( steemit::app::vote_state, (voter)(weight) );
FC_REFLECT( steemit::app::account_vote, (authorperm)(weight) );
FC_REFLECT( steemit::app::vote_state, (voter)(weight)(rshares)(percent)(time) );
FC_REFLECT( steemit::app::account_vote, (authorperm)(weight)(rshares)(percent)(time) );

FC_REFLECT( steemit::app::discussion_index, (category)(trending)(recent)(active)(votes)(maturing)(best) )
FC_REFLECT( steemit::app::category_index, (trending)(active)(recent)(best) )
Expand Down

0 comments on commit 4ef97be

Please sign in to comment.