Skip to content

Commit

Permalink
[1871] Simpler implementation of payout_per_share
Browse files Browse the repository at this point in the history
A less complicated fix for #11525.
  • Loading branch information
ollybh committed Feb 16, 2025
1 parent 94964d9 commit 834f4fd
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions lib/engine/game/g_1871/step/dividend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,10 @@ def share_price_change(_entity, revenue)
end

def payout_per_share(entity, revenue)
share_count =
if entity == @game.peir
# entity.total_shares doesn't always work correctly for PEIR.
# If there are three shares then each is a 33% share, and
# total_shares returns 3.030303...
@game.peir_shares.size
else
entity.total_shares
end
return super unless entity == @game.peir

# PEIR rounds up
(revenue.to_f / share_count).ceil
(revenue.to_f / @game.peir_shares.size).ceil
end

def half_pay_withhold_amount(_entity, revenue)
Expand Down

0 comments on commit 834f4fd

Please sign in to comment.