Fixes
This commit is contained in:
parent
fdd7c193a6
commit
12a8bdc590
2 changed files with 7 additions and 2 deletions
|
|
@ -58,12 +58,16 @@ 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 )
|
||||||
{
|
{
|
||||||
accumulator[affiliate] += asset( payout.to_uint64(), amount.asset_id );
|
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 );
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -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 );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue