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

[BUG] Days until event off cooldown when attempting to purchase an event that's on cooldown is wrong #67

Open
Mysteryem opened this issue Dec 29, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Mysteryem
Copy link

  1. What was expected to happen?
    When an event purchase is attempted while the event is on cooldown, the message in chat says how many days until the event can be purchased again.

  2. What actually happened?
    The number of days until the event can be purchased is wrong, the event can actually be purchased again sooner.

  3. What could have caused this? (optional but helpful)
    https://github.com/hodldeeznuts/twitchtoolkit/blob/552a388fd71b663fbb35638eb78e8acb30121e3c/TwitchToolkit/Store/Store_Component.cs#L131 There is no break in this foreach loop, assuming the ids in associateLogIDS are in order from oldest purchase to most recent purchase, the last id iterated and last assigned value of daysTillCooldownExpires will be for the most recent purchase of the event that has yet to expire. Even if the ids in associateLogIDS are not in any particular order, daysTillCooldownExpires will always end up as the last iterated id that has yet to expire which is wrong, it should be the minimum value of daysTillCooldownExpires (not including its initially assigned value, in its declaration, of -1) or otherwise the number of days until the oldest id, that has yet to expire, expires.

@Mysteryem Mysteryem added the bug Something isn't working label Dec 29, 2021
@Mysteryem
Copy link
Author

I've looked into this some more since we have ToolkitUtils which has its own event for buying pawns which is where the issue was being noticed. However, I've managed to produce the same behaviour from the meteor event.

I have a feeling that even failed attempts at purchasing the event are sometimes being included in calculating daysTillCooldownExpires as there's no reason that the cooldown time of the event should go up when the event hasn't even been purchased due to it being on cooldown.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant