Skip to content

Enforce a max card quantity #5

Description

@Ajordat

Currently, the maximum amount of copies for any given card is 65 as enforced here:

if (this.quantity > 65) {
    throw new EncodingError(`Cannot encode card quantity (${this.quantity}) greater than 65`)
}

I was wondering whether instead of failing we should instead limit the quantity:

this.quantity = Math.min(this.quantity, 65)

For sure this should only be relevant when encoding collections, which could cause confusion on users seeing that they "only" own 65 copies of a card instead of the 85 they see on the official app. However, I still think collections should be encoded on a best-effort basis and the whole encoding shouldn't fail because of this.

While I don't know much about Typescript, this is a simple enough change I could make myself in a PR, but I wanted to first discuss what should be the best approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions