Fix filteredViewTotals and chartAggregations to use per-transaction tags#13
Merged
terryaney merged 2 commits intoApr 29, 2026
Conversation
Closes davidfowl#92 Agent-Logs-Url: https://github.com/terryaney/OpenSource.tally/sessions/d529bfb8-fdb5-4912-afb7-c559a0c7f030 Co-authored-by: terryaney <6237247+terryaney@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix filteredViewTotals to use per-transaction tags
Fix filteredViewTotals and chartAggregations to use per-transaction tags
Apr 29, 2026
terryaney
approved these changes
Apr 29, 2026
terryaney
pushed a commit
that referenced
this pull request
Jul 9, 2026
…ags (#13) filteredViewTotals and chartAggregations to use per-transaction tags Fixes the Python-side bug — changing by_merchant to use a composite (merchant, category, subcategory) key so same-named merchants with different categories appear as separate rows. This significantly reduces the practical impact of the JavaScript-side bug described here. However, even after the PR fix, merchant.tags in the report data is still the union of all transaction tags within that merchant entry. When that union includes tags that not every transaction individually carries, filteredViewTotals misclassifies those transactions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both
filteredViewTotalsandchartAggregationswere hoistingmerchant.tags(the union of all tags across every transaction in that merchant entry) outside the transaction loop, causingcategorizeAmount()to misclassify transactions that individually carry only a subset of those tags. This produces a mismatch between the Filtered View KPI card and the Cash Flow KPI card (which Python precomputes per-transaction).Changes
filteredViewTotals— removed outerconst tags = merchant.tags || []; replacedcategorizeAmount(txn.amount, tags)withcategorizeAmount(txn.amount, txn.tags || [])chartAggregations— same fix: dropped merchant-level tags variable, passtxn.tags || []directlyEach transaction already carries its own
tagsarray in the report JSON, so no data-shape changes are required.