Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

bug (state): Receipt requirement is counting old receipts #299

Closed
Tracked by #13
timoguin opened this issue Oct 8, 2023 · 2 comments · Fixed by #318
Closed
Tracked by #13

bug (state): Receipt requirement is counting old receipts #299

timoguin opened this issue Oct 8, 2023 · 2 comments · Fixed by #318
Labels
bug Something isn't working.

Comments

@timoguin
Copy link
Contributor

timoguin commented Oct 8, 2023

Current Behavior

After connecting Gmail and a retailer account, the receipt count requirement will be satisfied after the initial scans if there are at least 5 past receipts discovered.

Expected Behavior

The receipt requirement should only be satisfied after 5 NEW receipts, not past receipts discovered during the initial scans.

@timoguin timoguin added the bug Something isn't working. label Oct 8, 2023
@timoguin timoguin changed the title bug: Receipt requirement is counting old receipts bug (state): Receipt requirement is counting old receipts Oct 8, 2023
@ricardobrg
Copy link
Contributor

It happens because we are using the microblink's receipt id to check for duplicity, but it is unique for each scan, not throughout scans.

https://github.com/tiki/apps-receipt-capacitor/blob/b44a20ff19342c76996638ddcfe59025ba7dedda/src/service/store/state/state-receipt.ts#L30-L33

An option to avoid duplicity is to use a hash as unique id, composed by the merchant and date and time of the receipt.

@mike-audi
Copy link
Contributor

mike-audi commented Oct 10, 2023

this is not a duplicity issue, the duplication is handled separately from the state management.

If we want the state to only reflect 5 new receipts, we need to be using the receipt date time fields (there are 2) to set the optional date field for the state.

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

Successfully merging a pull request may close this issue.

3 participants