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

Empty Restock Embeds #2

Open
subreme opened this issue Apr 4, 2022 · 1 comment
Open

Empty Restock Embeds #2

subreme opened this issue Apr 4, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@subreme
Copy link
Owner

subreme commented Apr 4, 2022

Bug Description

The webhook embeds for product restocks occasionally don't display any product variants as available.

To Reproduce

  1. Run monitor normally with the sizes option set to true
  2. Wait for a restocked product to quickly go Out of Stock
  3. Check webhooks on Discord

Expected Behavior

If a product were to go Out of Stock before the webhook notifying of its update is sent, the program should not send an empty embed.

The monitor could handle the scenario in one of the following ways:

  • Send "empty" embeds (current behavior)

This could make sense as it would be of no use to users for unavailable sizes to be marked as restocked, and would require no change to the program.

  • Do not send "variant-less" webhooks

This might not fare well with users, as the monitor may be perceived as "sub-par" if some restocks appear not to have been detected. This could be done by counting the number of fields in the embed after the message is generated before sending it.

  • Include all restocked variants anyway

The ideal "fix" would be to stop updating the list of available variants between the moment a restock is detected and the time the webhook is sent. If implemented incorrectly, this could result in some "segmented restocks" where a product is updated while another one's corresponding message is being generated is never detected, but this issue can be avoided.

Screenshots

Imgur

In the image above, the first product's restock is presented normally, however the second embed does not contain any available sizes.

Environment

  • OS: Linux (Manjaro)
  • Browser: Chromium
  • Version: v0.1.2

Additional Notes

This is not a platform-specific issue, but rather a design flaw in the way the program handles the list of products it is keeping track of.

I'm creating this issue as there are a lot of bugs I noticed but ended up forgetting about, never implementing their fixes, and hope that this way I'll remind myself of what I need to fix.

By actually trying it, I am also testing out the issue templates, which should help me come up with ways to improve them to update my rust-template repository. Including screenshots in the Bug Description section, for example, would probably be better.

@subreme subreme added the bug Something isn't working label Apr 4, 2022
@subreme
Copy link
Owner Author

subreme commented Apr 4, 2022

The bug arises in this part of monitor.rs. The relevant lines have been copied below:

for variant in (*settings.product.variants).iter() {
    fields.push(Field {
        name: format!("Size {}", variant.name),
        inline: Some(true),
        value: format!("[ATC]({}/cart/add?id={})", settings.store_url, variant.id),
    });
}

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