Skip to content

Filter out zero-count set bonuses in setBonusCountsToStately function#281

Merged
bhollis merged 2 commits intomasterfrom
copilot/fix-280
Aug 14, 2025
Merged

Filter out zero-count set bonuses in setBonusCountsToStately function#281
bhollis merged 2 commits intomasterfrom
copilot/fix-280

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 13, 2025

The setBonusCountsToStately function was storing set bonus entries with zero counts in the Stately database, which doesn't make logical sense since you can't have 0 pieces of a set bonus.

This change adds filtering to exclude any set bonus entries where the count is 0, negative, or undefined before storing them in the database:

// Before: All entries were stored regardless of count
return Object.entries(setBonuses).map(([setBonusHash, count]) => ...)

// After: Only meaningful (positive) counts are stored  
return Object.entries(setBonuses)
  .filter(([, count]) => count !== undefined && count > 0)
  .map(([setBonusHash, count]) => ...)

The change includes a comprehensive test case that verifies:

  • Zero-count entries are filtered out when converting to Stately format
  • Valid entries (count > 0) are preserved
  • Roundtrip conversion works correctly with the filtered data
  • Edge cases like negative and undefined counts are handled properly

This is a minimal, targeted fix that follows the same pattern used elsewhere in the codebase for filtering out default/meaningless values, and only affects the internal data storage without impacting any external APIs.

Fixes #280.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.sentry-cdn.com
  • stately.cloud
    • Triggering command: node ./bin/install.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Aug 13, 2025

@bhollis 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Co-authored-by: bhollis <313208+bhollis@users.noreply.github.com>
Copilot AI changed the title [WIP] Filter set bonus counts that are zero Filter out zero-count set bonuses in setBonusCountsToStately function Aug 13, 2025
Copilot AI requested a review from bhollis August 13, 2025 20:53
@bhollis bhollis marked this pull request as ready for review August 13, 2025 22:43
@bhollis bhollis merged commit 176fe3b into master Aug 14, 2025
@bhollis bhollis deleted the copilot/fix-280 branch August 14, 2025 15:23
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.

Filter set bonus counts that are zero

2 participants