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

[18Uruguay] Interest should not be paid for penalty loans #11455

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

patrikolesen
Copy link
Contributor

Fixes #11447

Can potentially break existing games

Before clicking "Create"

  • Branch is derived from the latest master
  • Add the pins or archive_alpha_games label if this change will break existing games
  • Code passes linter with docker compose exec rack rubocop -a
  • Tests pass cleanly with docker compose exec rack rake

Implementation Notes

Explanation of Change

Screenshots

Any Assumptions / Hacks

while owed > entity.cash &&
(loan = loans[0])
take_loan(entity, loan, ebuy: true)
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you test this code? in the original implementation (interest_on_loans.rb),
owed = interest_owed(entity) is inside the loop, to update the owed value.
What's updating the owed value to prevent an infinite loop?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do need to add that line, it looks like this code is identical to the one in interest_on_loans.rb, except
entity.loans.size < maximum_loans(entity)

could you make the max high enough and then prevent this duplication?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two changes here from the "original"

  1. That you in this case are allowed to take more than what is normally allowed
  2. It is by intension that owed is not updated. We do not want to pay interest on loans that we are forced to take due to interest payments. The entity.cash is increased for every loop so it will drop out when the entity has enough cash to pay the interest

@bentziaxl bentziaxl merged commit a52c523 into tobymao:master Jan 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[18Uruguay] Interest should not be paid for penalty loans
2 participants