This commit is contained in:
Peter Conrad 2018-04-10 21:59:51 +02:00 committed by Fabian Schuh
parent fdd7c193a6
commit 12a8bdc590
No known key found for this signature in database
GPG key ID: F2538A4B282D6238
2 changed files with 7 additions and 2 deletions

View file

@ -58,11 +58,15 @@ namespace graphene { namespace chain {
FC_ASSERT( share < remaining ); FC_ASSERT( share < remaining );
payout *= share; payout *= share;
payout /= remaining; payout /= remaining;
//ilog("Paying ${p} of ${P} for ${s} of ${r}", ("p",payout.to_uint64())("P",to_pay.value)("s",share)("r",remaining) );
remaining -= share; remaining -= share;
} }
FC_ASSERT( payout.to_uint64() <= to_pay ); FC_ASSERT( payout.to_uint64() <= to_pay );
if( payout > 0 ) if( payout > 0 )
{ {
if ( accumulator.find(affiliate) == accumulator.end() )
accumulator[affiliate] = asset( payout.to_uint64(), amount.asset_id );
else
accumulator[affiliate] += asset( payout.to_uint64(), amount.asset_id ); accumulator[affiliate] += asset( payout.to_uint64(), amount.asset_id );
to_pay -= payout.to_uint64(); to_pay -= payout.to_uint64();
paid += payout.to_uint64(); paid += payout.to_uint64();
@ -82,6 +86,7 @@ namespace graphene { namespace chain {
_db.adjust_balance( entry.first, entry.second ); _db.adjust_balance( entry.first, entry.second );
_db.push_applied_operation( affiliate_payout_operation( entry.first, tag, entry.second ) ); _db.push_applied_operation( affiliate_payout_operation( entry.first, tag, entry.second ) );
} }
accumulator.clear();
} }
} } // graphene::chain } } // graphene::chain

View file

@ -59,7 +59,7 @@ namespace graphene { namespace chain {
public: public:
template<typename GAME> template<typename GAME>
affiliate_payout_helper( database& db, const GAME& game ) affiliate_payout_helper( database& db, const GAME& game )
: tag( get_tag_for_game( game ) ), _db(db) {} : _db(db), tag( get_tag_for_game( game ) ) {}
share_type payout( account_id_type player, const asset& amount ); share_type payout( account_id_type player, const asset& amount );
share_type payout( const account_object& player, const asset& amount ); share_type payout( const account_object& player, const asset& amount );