Skip to content

Fix backfill script to handle zero-value costs and prices#13

Merged
mightea merged 2 commits into
currency-improvementsfrom
copilot/sub-pr-12
Feb 15, 2026
Merged

Fix backfill script to handle zero-value costs and prices#13
mightea merged 2 commits into
currency-improvementsfrom
copilot/sub-pr-12

Conversation

Copilot AI commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

The backfill script used truthy checks that incorrectly skipped 0 values for purchase prices and maintenance costs.

Changes:

  • Replace if (moto.purchasePrice) with if (moto.purchasePrice != null)
  • Replace if (record.cost) with if (record.cost != null)

This ensures zero-cost items are normalized while still skipping null/undefined values.

// Before: skips valid zero values
if (moto.purchasePrice) {
    const normalizedPrice = moto.purchasePrice * factor;
    // ...
}

// After: only skips null/undefined
if (moto.purchasePrice != null) {
    const normalizedPrice = moto.purchasePrice * factor;
    // ...
}

💡 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.

Copilot AI mentioned this pull request Feb 15, 2026
@mightea
mightea marked this pull request as ready for review February 15, 2026 14:10
Co-authored-by: mightea <3684954+mightea@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on currency improvements pull request Fix backfill script to handle zero-value costs and prices Feb 15, 2026
@mightea
mightea merged commit 0dd5861 into currency-improvements Feb 15, 2026
@mightea
mightea deleted the copilot/sub-pr-12 branch February 15, 2026 14:12
Copilot AI requested a review from mightea February 15, 2026 14:12
Copilot stopped work on behalf of mightea due to an error February 15, 2026 14:12
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.

2 participants