Skip to content

fix: apply Costco discounts referenced by description instead of item number#21

Merged
eshaffer321 merged 1 commit into
mainfrom
fix/costco-discount-description-ref
May 24, 2026
Merged

fix: apply Costco discounts referenced by description instead of item number#21
eshaffer321 merged 1 commit into
mainfrom
fix/costco-discount-description-ref

Conversation

@eshaffer321
Copy link
Copy Markdown
Owner

Summary

  • Costco sometimes references a discount's parent item by description (e.g. /AAA BATTERY) rather than by item number (e.g. /1234567)
  • Previously these were logged as orphaned and the -$2.50 discount was dropped, leaving the item at full price
  • Fix adds a descMap keyed by uppercased description as a fallback when the item-number lookup misses

Test plan

  • New test: discount references parent by description instead of item number — red before fix, green after
  • All existing discount-netting tests still pass
  • go test ./... -race clean

… number

Some Costco receipt lines reference their parent item by description
(e.g. "/AAA BATTERY") rather than item number (e.g. "/1234567").
Add a description-keyed fallback map so these discounts are correctly
netted against the parent price instead of being logged as orphaned.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.41%. Comparing base (9cdcc9f) to head (997f79b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #21      +/-   ##
==========================================
+ Coverage   56.36%   56.41%   +0.05%     
==========================================
  Files          43       43              
  Lines        4801     4807       +6     
==========================================
+ Hits         2706     2712       +6     
  Misses       1931     1931              
  Partials      164      164              
Flag Coverage Δ
unittests 56.41% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
internal/adapters/providers/costco/provider.go 43.71% <100.00%> (+1.90%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eshaffer321 eshaffer321 merged commit 4d537e9 into main May 24, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant