Fix shareholder earnings in UI being per cycle instead of per sec

This commit is contained in:
Staszek Welsh 2022-05-30 22:24:52 +01:00
parent c117b55df9
commit 74e4a32f13

@ -279,13 +279,14 @@ function DividendsStats({ profit }: IDividendsStatsProps): React.ReactElement {
const totalDividends = corp.dividendRate * profit; const totalDividends = corp.dividendRate * profit;
const retainedEarnings = profit - totalDividends; const retainedEarnings = profit - totalDividends;
const dividendsPerShare = totalDividends / corp.totalShares; const dividendsPerShare = totalDividends / corp.totalShares;
const playerEarnings = corp.getDividends() / CorporationConstants.SecsPerMarketCycle;
return ( return (
<StatsTable <StatsTable
rows={[ rows={[
["Retained Profits (after dividends):", <MoneyRate money={retainedEarnings} />], ["Retained Profits (after dividends):", <MoneyRate money={retainedEarnings} />],
["Dividend Percentage:", numeralWrapper.format(corp.dividendRate, "0%")], ["Dividend Percentage:", numeralWrapper.format(corp.dividendRate, "0%")],
["Dividends per share:", <MoneyRate money={dividendsPerShare} />], ["Dividends per share:", <MoneyRate money={dividendsPerShare} />],
["Your earnings as a shareholder:", <MoneyRate money={corp.getDividends()} />], ["Your earnings as a shareholder:", <MoneyRate money={playerEarnings} />],
]} ]}
/> />
); );