Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1871] Fix dividend payout when there are three PEIR shares #11531

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/engine/game/g_1871/step/dividend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ 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
# PEIR rounds up
(revenue.to_f / entity.total_shares).ceil
(revenue.to_f / share_count).ceil
end

def half_pay_withhold_amount(_entity, revenue)
Expand Down