Skip to content

Commit

Permalink
Rename bandwidth fields of account object and add lifetime bandwidth s…
Browse files Browse the repository at this point in the history
  • Loading branch information
zxcat committed Jun 5, 2018
1 parent 1c98c1d commit 8cb9690
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 5 additions & 3 deletions libraries/api/account_api_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@ account_api_object::account_api_object(const account_object& a, const golos::cha

auto post = db.find<account_bandwidth_object, by_account_bandwidth_type>(std::make_tuple(name, bandwidth_type::post));
if (post != nullptr) {
last_root_post = post->last_bandwidth_update;
post_bandwidth = post->average_bandwidth;
last_root_post = post->last_bandwidth_update;
}

auto forum = db.find<account_bandwidth_object, by_account_bandwidth_type>(std::make_tuple(name, bandwidth_type::forum));
if (forum != nullptr) {
new_average_bandwidth = forum->average_bandwidth;
average_bandwidth = forum->average_bandwidth;
lifetime_bandwidth = forum->lifetime_bandwidth;
last_bandwidth_update = forum->last_bandwidth_update;
}

auto market = db.find<account_bandwidth_object, by_account_bandwidth_type>(std::make_tuple(name, bandwidth_type::market));
if (market != nullptr) {
new_average_market_bandwidth = market->average_bandwidth;
average_market_bandwidth = market->average_bandwidth;
lifetime_market_bandwidth = market->lifetime_bandwidth;
last_market_bandwidth_update = market->last_bandwidth_update;
}
}
Expand Down
9 changes: 6 additions & 3 deletions libraries/api/include/golos/api/account_api_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ struct account_api_object {

uint16_t witnesses_voted_for;

share_type average_bandwidth;
share_type average_market_bandwidth;
share_type lifetime_bandwidth;
share_type lifetime_market_bandwidth;
time_point_sec last_bandwidth_update;
time_point_sec last_market_bandwidth_update;
time_point_sec last_post;
time_point_sec last_root_post;
share_type post_bandwidth = STEEMIT_100_PERCENT;

share_type new_average_bandwidth;
share_type new_average_market_bandwidth;
set<string> witness_votes;

fc::optional<share_type> reputation;
Expand All @@ -107,8 +109,9 @@ FC_REFLECT((golos::api::account_api_object),
(savings_withdraw_requests)(vesting_shares)(delegated_vesting_shares)(received_vesting_shares)
(vesting_withdraw_rate)(next_vesting_withdrawal)(withdrawn)(to_withdraw)(withdraw_routes)
(curation_rewards)(posting_rewards)(proxied_vsf_votes)(witnesses_voted_for)
(average_bandwidth)(average_market_bandwidth)(lifetime_bandwidth)(lifetime_market_bandwidth)
(last_bandwidth_update)(last_market_bandwidth_update)
(last_post)(last_root_post)(post_bandwidth)(new_average_bandwidth)(new_average_market_bandwidth)
(last_post)(last_root_post)(post_bandwidth)
(witness_votes)(reputation))

#endif //GOLOS_ACCOUNT_API_OBJ_HPP

0 comments on commit 8cb9690

Please sign in to comment.