Beta

Calculate daily accurate interest for a bank account

20Odd
Description
Loading description...
Algorithms
View
AllIssues3QuestionsSuggestions1Show Resolved
  • Please sign in or sign up to leave a comment.
  • dfhwze Avatar

    Very tedious kata

  • Odd Avatar

    Hello, original author here. Thank you for investing your time and cleaning up the Kata.

    The changes look good to me.

  • 4500zenja1 Avatar

    A fork which should fix all issues below + make the testing code up-to-date with the current katas, full info in the fork comments (Katafix helped)

  • Voile Avatar

    Fixed tests are written incorrectly: user function should be called per test block, and not in batch in advance, because user logs will cluster together before any test blocks, which cannot be correlated to the specific test assertion (and is pretty unreadable too).

    Also, tests are not displaying expected value (0 is not the expected balance.), which is unacceptable.

    ALSO, failure assertion message for the random tests is wrong: every one of them displays Transactions: [('2015-01-01 10:12:13', 123.45), ('2015-01-01 15:12:13', 123.45), ('2015-02-07 18:00:00', 123.45)] but this is the first fixed test, not the actual transactions being tested.

    • 4500zenja1 Avatar

      Since the author, Odd, is inactive since October 2020, I've decided to fix this kata by myself and, after publishing, merged the fix fork above your comment; it should resolve all the issue points you've written about.

      Feel free to reraise if I've missed something, for now closing this issue as resolved~

      Issue marked resolved by 4500zenja1 2 months ago
  • akar-0 Avatar

    The third parameter should be renamed to 'initial_balance'.

  • ZED.CWT Avatar

    Needs Random Tests

    • Odd Avatar

      You are right, I wanted to add some random tests but haven't yet. Is there a better way to access my solution to use it in the tests to calculate the result for the random input than copying it to the test code under a random name?

    • ZED.CWT Avatar

      It's common to put the reference solution in the complete test. If you are considering about anti-cheat, firstly, you may have to think of what to prevent.

    • Odd Avatar

      I added random tests now, thanks for your help.

      Issue marked resolved by Odd 5 years ago
  • Voile Avatar

    If the balance becomes negative over a period of the year, the same interest rate is still used (no penalty is applied)

    So should interest rate stay the same or be deducted?

    • Odd Avatar

      If the balance is negative, let's say -100 for 10 days and interest per year (assuming 365 for this reply) is 0.01 or 1%, then you would calculate -100 * 10 days * (0.01 / 365) = -0,027397260273973 So, yes it would be deducted, you would have to pay interest to the bank for that period.

      Issue marked resolved by Odd 5 years ago