Commit Graph

1139 Commits

Author SHA1 Message Date
Nuno Marques
0a5e815732 fix: export counter 2026-01-20 23:49:48 +00:00
Nuno Marques
80290fc0c7 fix: delete unused partial file to render export entries 2026-01-20 23:49:09 +00:00
Nuno Marques
571d09a869 fix: date formats 2026-01-20 23:48:22 +00:00
Nuno Marques
7f69063a95 refactor: Imports section and updated translation files 2026-01-20 23:21:42 +00:00
Nuno Marques
6ba0189e07 refactor: Exports section and updated translation files 2026-01-20 23:21:27 +00:00
Nuno Marques
f8860c091f feat: created Badge component 2026-01-20 23:20:10 +00:00
Nuno Marques
388e1759a9 fix: pagination background 2026-01-20 23:19:34 +00:00
Julien Orain
777fbdc4ca feat(settings): add pagination to imports and exports pages (#598)
* feat(settings): split imports and exports

* feat(security): sanitize pagination params to prevent abuse

* fix(settings): fix syntax in settings nav

* feat(settings): internationalize family_exports and imports UI strings

* fix(settings): fix coderabbit review

* fix(settings): fix coderabbit review

* fix(settings): fix coderabbit review

* Change default per_page value from 20 to 10

Signed-off-by: Juan José Mata <jjmata@jjmata.com>

* Add `/family_export` to navigation

* Consistency with old defaults

* Align `safe_per_page` even if not DRY

---------

Signed-off-by: Julien Orain <julien.orain@gmail.com>
Signed-off-by: Juan José Mata <jjmata@jjmata.com>
Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: JulienOrain <your-github-email@example.com>
Co-authored-by: Juan José Mata <jjmata@jjmata.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2026-01-20 00:11:22 +01:00
David Gil
3d91e60a8a feat: Add subcategory breakdown to Cash Flow Sankey and Reports (#639)
* feat: Add subcategory breakdown to Cash Flow and Reports

Implements Discussion #546 - adds hierarchical category/subcategory
visualization to both the Sankey chart and Reports breakdown tables.

Sankey chart changes:
- Income: subcategory → parent category → Cash Flow
- Expense: Cash Flow → parent category → subcategory
- Extracted process_category_totals helper to DRY up income/expense logic

Reports breakdown changes:
- Subcategories display nested under parent categories
- Smaller dots and indented rows for visual hierarchy
- Extracted _breakdown_table partial to eliminate duplication

* fix: Dynamic node padding for Sankey chart with many nodes

- Add dynamic nodePadding calculation to prevent padding from dominating
  chart height when there are many subcategory nodes
- Extract magic numbers to static constants for configuration
- Decompose monolithic #draw() into focused methods
- Consolidate duplicate tooltip/currency formatting code
- Modernize syntax with spread operators and optional chaining

* fix: Hide overlapping Sankey labels, show on hover

- Add label overlap detection by grouping nodes by column depth
- Hide labels that would overlap with adjacent nodes
- Show hidden labels on hover (node rectangle or connected links)
- Add hover events to node rectangles (not just text)

* fix: Use deterministic fallback colors for categories

- Replace Category::COLORS.sample with Category::UNCATEGORIZED_COLOR
  for income categories in Sankey chart (was producing different colors
  on each page load)
- Add nil color fallback in reports_controller for parent and root
  categories

Addresses CodeRabbit review feedback.

* fix: Expand CSS variable map for d3 color manipulation

Add hex mappings for commonly used CSS variables so d3 can manipulate
opacity for gradients and hover effects:
- var(--color-destructive) -> #EC2222
- var(--color-gray-400) -> #9E9E9E
- var(--color-gray-500) -> #737373

* test: Add tests for subcategory breakdown in dashboard and reports

- Test dashboard renders Sankey chart with parent/subcategory transactions
- Test reports groups transactions by parent and subcategories
- Test reports handles categories with nil colors
- Use EntriesTestHelper#create_transaction for cleaner test setup

* Fix lint: use Number.NEGATIVE_INFINITY

* Remove obsolete nil color test

Category model now validates color presence, so nil color categories
cannot exist. The fallback handling in reports_controller is still in
place but the scenario is unreachable.

* Update reports_controller.rb

* FIX trade category

---------

Co-authored-by: sokie <sokysrm@gmail.com>
2026-01-20 00:01:55 +01:00
Alessio Cappa
2e081ea82d fix: Move rule application to perform_post_sync method (#705)
* Move rule application to perform_post_sync method

Signed-off-by: Alessio Cappa <104093777+alessiocappa@users.noreply.github.com>

* fix: Update test

---------

Signed-off-by: Alessio Cappa <104093777+alessiocappa@users.noreply.github.com>
2026-01-19 22:57:46 +01:00
LPW
8b8ac705f6 Correct brokerage cash calculation for SimpleFIN investment accounts (#710)
* Refactor: Enhance cash balance calculation and holdings management with money market classification and provider-sourced data handling

* Fix: Clear fixture holdings in test to ensure clean creation and update raw_holdings_payload format

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-19 22:17:27 +01:00
soky srm
63dd231787 Merge pull request #686 from TDemeco/fix/yahoo-securities-caching
fix: avoid cached result bypass in Yahoo Finance provider
2026-01-19 20:28:53 +01:00
LPW
8f04955e72 Move exchange MIC codes to config/exchanges.yml (#708)
* Move exchange MIC code mappings to `exchanges.yml` for better maintainability.

* fix: Use YAML.safe_load_file for exchange config

Addresses CodeRabbit security concern - YAML.load_file can deserialize
arbitrary Ruby objects. safe_load_file restricts to basic types only.

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-19 19:28:16 +01:00
LPW
237035c8d4 Improve convert-to-trade security selection with search-first UX (#703)
* Enhance security handling logic:
- Prioritize user's country in sorting securities and country codes.
- Add comprehensive mapping for MIC codes to user-friendly exchange names.
- Revamp combobox to consistently pull from a provider when available.
- Improve handling of custom ticker and exchange input fields.

* Localize securities combobox display and exchange labels.

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-19 15:49:51 +01:00
LPW
bf9bcae600 Add gains by tax treatment to investment report with grouped subtype dropdown (#701)
* Add tax treatment metrics to reports, forms, and models

- Implement `build_gains_by_tax_treatment` for grouping gains by tax treatment
- Update investment performance view with tax treatment breakdown
- Add tax treatment field to crypto and investments forms
- Introduce `realized_gain_loss` calculation in the Trade model
- Group investment subtypes by region for improved dropdown organization

* Optimize investment performance report by reducing N+1 queries

- Eager-load associations in `build_gains_by_tax_treatment` to minimize database queries
- Preload holdings for realized gain/loss calculations in trades
- Refactor views to standardize "no data" placeholder using translations
- Adjust styling in tax treatment breakdown for improved layout

* Enhance investment performance translations and optimize holdings lookup logic

- Update `holdings_count` and `sells_count` translations to handle pluralization
- Refactor views to use pluralized translation keys with count interpolation
- Optimize preloaded holdings lookup in `Trade` to ensure deterministic selection using `select` and `max_by`

* Refine preloaded holdings logic in `Trade` model

- Treat empty preloaded holdings as authoritative to prevent unnecessary DB queries
- Add explicit fallback behavior for database query when holdings are not preloaded

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-19 15:44:49 +01:00
Mark Hendriksen
7f0781179c Add Dutch (nl) translations for UI and models (#702)
* Add Dutch (nl) translations for UI and models

Added comprehensive Dutch translation files for models, views, mailers, and Doorkeeper, covering accounts, categories, admin, and more. Updated languages_helper.rb to include 'nl' as a supported language. Improved capitalization and consistency in existing Dutch date and number formats.

* ai sugestions

* nitpick fix

* Fix Dutch translations and improve consistency

Corrected minor issues and improved consistency in Dutch locale files, including fixing typos, updating terminology (e.g., 'Self-Hosting' to 'Zelfhosting', 'Provider selectie' to 'Providerselectie'), and ensuring proper formatting. No functional changes were made; this commit only affects translation files.

* Update Dutch translations for product name and pluralization

Replaced hardcoded product names with %{product_name} in password reset and API key views for improved reusability. Updated wallet setup message in CoinStats item model to support correct Dutch pluralization.

* Update nl.yml
2026-01-19 15:42:55 +01:00
Alessio Cappa
e1a2ec901c feat: Allow to change country code in already existing Enable Banking connection, to link banks from other countries (#699) 2026-01-19 13:57:07 +01:00
LPW
64dc5c2fb8 Add tax treatment classification for investment accounts with international support (#693)
* Add tax treatment support for accounts, investments, and cryptos

* Replace hardcoded region labels with I18n translations

* Add I18n support for subtype labels with fallback to hardcoded values

* fixed schema

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-18 17:29:02 +01:00
Alessio Cappa
6ec03e93f4 fix: Properly compute credit card balance for Enable Banking accounts (#663)
* fix: Properly compute credit card balance for Enable Banking accounts

* fix: Use right balance type codes

* fix: Update comment
2026-01-18 15:11:34 +01:00
LPW
f97ff419e8 Allow manual entry on linked accounts (#689)
* Update activity menu to conditionally display options for linked and investment accounts

* Update transaction test to reflect "New activity" menu change

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-18 15:08:27 +01:00
Alessio Cappa
3ea102d14f fix: Force top-0 on tooltip div to avoid overflow issues on mobile (#695) 2026-01-18 13:20:03 +01:00
foXaCe
302fb84086 feat: Support multiple crypto wallets with same token (#676)
* feat: Support multiple crypto wallets with same token

Allows users to import multiple wallets containing the same
cryptocurrency (e.g., ETH on different wallet addresses).

Changes:
- Add wallet_address column to coinstats_accounts
- Update uniqueness validation to include wallet_address
- Extract and store wallet address in WalletLinker
- Add composite unique index on [item_id, account_id, wallet_address]
- Add tests for multi-wallet support and backwards compatibility

Users can now have:
- ETH (0xAAA...) → "Ethereum (0xAA...AA)"
- ETH (0xBBB...) → "Ethereum (0xBB...BB)"

Backwards compatible: existing accounts with wallet_address: nil
continue to work.

* style: Fix array bracket spacing in migration

* chore: Update schema.rb with wallet_address column and index

Add the missing wallet_address column and composite unique index
to db/schema.rb for CI compatibility with db:schema:load

* test: Add test for wallet deletion with same token different addresses

Verifies that deleting one wallet does not affect other wallets
that share the same token but have different addresses.

Addresses review comment from @EthanC via @jjmata

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2026-01-18 11:27:09 +01:00
Mark Hendriksen
79d14c142f Remove relative positioning from net worth chart div (#687)
The 'relative' class was removed from the net worth chart container, possibly to resolve layout or stacking issues. The chart should now rely on default positioning.
2026-01-18 11:21:35 +01:00
Juan José Mata
7f854aaded Remove "contact support" text 2026-01-18 08:13:29 +00:00
LPW
0f6dd536df Enhance ticker search and validation in "Convert to Trade" form (#688)
- Updated resolution logic to support combobox-based ticker selection and validation.
- Added market price display with validation against entered prices to detect significant mismatches.
- Improved messaging and UI for custom ticker input and market price warnings.

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-17 22:46:15 +01:00
Juan José Mata
47e0185409 fix: Allow locale preview on onboarding preferences page (#682)
* fix: Allow locale preview on onboarding preferences page

When a user selects a different language on /onboarding/preferences,
the page now immediately displays in the selected language. This is
achieved by checking for a valid locale URL parameter before falling
back to the family's saved locale setting.

* fix: Harden locale param handling and restore locale in tests

- Add type check to ensure params[:locale] is a String before calling
  .to_sym, preventing 500 errors from array/hash injection attacks
- Add teardown to tests to restore original locale, preventing test
  pollution

* fix: Reload family in teardown to handle update_column

* fix: Remove edge case test that used update_column with nil locale

* fix: Simplify localize tests - rely on fixture defaults and transactional isolation

* fix: Update system test to expect Spanish button text after locale preview

* refactor: Use I18n.t for button text in system test instead of hardcoded string

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-17 17:59:10 +01:00
Tobi Demeco
c0bc695ee0 fix: 🐛 properly return cached securities info wrapped in Provider::Response object 2026-01-17 12:24:31 -03:00
Nuno Marques
527155a46f UI quick fixes (#684)
* fix: changed bg-surface-hover color for dark theme

* fix: added hover state to table entries on Tags and Accounts lists

* fix: added bottom margin on tag creation element preview

* fix: added overflow property to accounts table wrapper
2026-01-17 15:59:37 +01:00
LPW
9792ab838f Make first user of instance automatically super_admin (#655)
* Implement dynamic role assignment for new family creators.

Introduced `User.role_for_new_family_creator` to assign `super_admin` to the first user of an instance and a configurable fallback role (e.g., `admin`) to subsequent users. Updated controllers and tests accordingly.

* Update default fallback role for family creators to admin.

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-16 21:27:55 +01:00
LPW
0c2026680c Improve investment activity labels UX and add convert-to-trade feature (#649)
* Add `investment_activity_label` to trades and enhance activity label handling

- Introduced `investment_activity_label` column to the `trades` table with a migration.
- Backfilled existing `trades` with activity labels based on quantity (`Buy`, `Sell`, or `Other`).
- Replaced `category_id` in trades with `investment_activity_label` for better alignment with transaction labels.
- Updated views and controllers to display and manage activity labels for trades.
- Added localized badge components for displaying and editing labels dynamically.
- Enhanced `PlaidAccount::Investments::TransactionsProcessor` to assign and process activity labels automatically.
- Added investment flows section to reports for tracking contributions and withdrawals.
- Refactored related tests and models for consistency and to ensure proper validation and filtering.

* Improve handling of `investment_activity_label`, trade type, and security selection in trades and transactions

- Refined label assignment logic in `trades_controller` to default to `Buy`/`Sell` based on transaction nature.
- Simplified security selection in `transactions_controller` by resolving via unique IDs or custom tickers.
- Streamlined UI for trade and transaction forms by updating dropdown options and label text.
- Enabled quick-edit badges to open `convert_to_trade` modal when applicable, enhancing flexibility.
- Adjusted tests and views to align with updated workflows and ensure consistent behavior.

* Improve handling of `investment_activity_label`, trade type, and security selection in trades and transactions

- Refined label assignment logic in `trades_controller` to default to `Buy`/`Sell` based on transaction nature.
- Simplified security selection in `transactions_controller` by resolving via unique IDs or custom tickers.
- Streamlined UI for trade and transaction forms by updating dropdown options and label text.
- Enabled quick-edit badges to open `convert_to_trade` modal when applicable, enhancing flexibility.
- Adjusted tests and views to align with updated workflows and ensure consistent behavior.

* Improve handling of `investment_activity_label`, trade type, and security selection in trades and transactions

- Refined label assignment logic in `trades_controller` to default to `Buy`/`Sell` based on transaction nature.
- Simplified security selection in `transactions_controller` by resolving via unique IDs or custom tickers.
- Streamlined UI for trade and transaction forms by updating dropdown options and label text.
- Enabled quick-edit badges to open `convert_to_trade` modal when applicable, enhancing flexibility.
- Adjusted tests and views to align with updated workflows and ensure consistent behavior.

* Add safeguard for `dropdownTarget` existence in quick edit controller

- Prevent errors by ensuring `dropdownTarget` is present before toggling its visibility.

* Fix undefined method 'category' for Trade on mobile view

Trade model uses investment_activity_label, not category. The upstream
merge introduced a call to trade.category which doesn't exist. Use the
activity label badge on mobile instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix activity label logic for zero/blank quantity and sell inference

- Return `nil` for blank or zero quantity in `investment_activity_label_for`.
- Correct `is_sell` logic to use the amount’s sign properly in `transactions_controller`.

* Fix i18n key paths in transactions controller for convert_to_trade

- Update flash message translations to use full i18n paths.
- Use `BigDecimal` for quantity and price calculations to improve precision.

---------

Co-authored-by: Josh Waldrep <joshua.waldrep5+github@gmail.com>
Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 21:04:10 +01:00
LPW
1ca84d8048 Fix missing SSO JIT account creation template (#679)
* Add UI and functionality for new user registration via OIDC integration

* Add tests and localization for new user registration via OIDC

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-16 21:00:24 +01:00
LPW
c391ba2b23 Harden SimpleFIN sync: protect user data, fix stuck syncs, optimize API calls (#671)
* Implement entry protection flags for sync overwrites

- Added `user_modified` and `import_locked` flags to `entries` table to prevent provider sync from overwriting user-edited and imported data.
- Introduced backfill migration to mark existing entries based on conditions.
- Enhanced sync and processing logic to respect protection flags, track skipped entries, and log detailed stats.
- Updated UI to display skipped/protected entries and reasons in sync summaries.

* Localize error details summary text and adjust `sync_account_later` method placement

* Restored schema.rb

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-16 12:34:06 +01:00
foXaCe
3fc3e20c36 i18n: Add French translations (#658)
* i18n: Add French translations

Add complete French translation files for the application.

Co-Authored-By: Norman Alié <mail@normanalie.fr>
Co-Authored-By: Xurron <corentin.boeglin2005@gmail.com>

* fix: Correct YAML syntax in French securities translations

Co-Authored-By: Norman Alié <mail@normanalie.fr>
Co-Authored-By: Xurron <corentin.boeglin2005@gmail.com>

---------

Co-authored-by: Norman Alié <mail@normanalie.fr>
Co-authored-by: Xurron <corentin.boeglin2005@gmail.com>
2026-01-15 21:42:39 +01:00
soky srm
4cc321a083 Family merchant logo (#660)
* FIX merchant regression

* Add logo support for family merchants

* Update family_merchant.rb
2026-01-15 17:00:32 +01:00
soky srm
d1b8d585ce FIX merchant regression (#659) 2026-01-15 13:14:10 +01:00
Alessio Cappa
fabd60c098 fix: PWA display issues (#653)
* feat: re-apply PWA changes from previous PR

* feat: adjust padding on pages for mobile

* fix: Add position relative to netWorthChart to avoid overflow issues on mobile

* fix: Add safe-area to progress bar

* feat: add missing class on html

* fix: Replace touch-none with overscroll-none
2026-01-15 12:53:35 +01:00
Alessio Cappa
5d6abf7b48 feat: Add more category icons (#651)
* feat: Add more category icons

* fix: Fix icon name typo
2026-01-15 10:34:09 +01:00
Alessio Cappa
a50c48d3cf fix: Investments page mobile (#654)
* fix: Mobile layout UI adjustment for trade page

* fix: Adjust table in holdings tab on mobile

* fix: properly manage width on desktop
2026-01-15 10:32:52 +01:00
Mark Hendriksen
e9ae80c9fa Update selection bar styles and group classes (#648)
* Update selection bar styles and group classes

Replaces hardcoded color classes with design token classes for background, border, and text. Updates group and group-hover class names for edit and delete actions to use more specific variants.

* make the selection dars the same
2026-01-14 19:42:44 +01:00
Jose
8f164b20ef fix(api): Use authorize_scope! for merchants and tags controllers (#643)
* Add files via upload

Signed-off-by: Jose <39016041+jospaquim@users.noreply.github.com>

* Add merchants and tags resources to routes

Signed-off-by: Jose <39016041+jospaquim@users.noreply.github.com>

* update

* update spaces

* fix: Apply CodeRabbit suggestions and add YARD documentation

* docs: Add API documentation for merchants and tags endpoints

* fix: Address CodeRabbit feedback on documentation

* fix: Use authorize_scope! instead of ensure_read_scope

---------

Signed-off-by: Jose <39016041+jospaquim@users.noreply.github.com>
2026-01-14 11:22:19 +01:00
LPW
a780b34421 Fix SimpleFIN liability balance sign when transaction history is incomplete (#642)
* Add sanity check for net balance mismatch in overpayment analysis

- Introduced a validation to detect cases where transactions' net balance deviates significantly from the observed balance (using a 10% or $5 tolerance).
- Returns `:unknown` with a `net-balance-mismatch` error for incomplete data scenarios.

* Clarify liability net-balance comparison logic in overpayment analysis.

---------

Co-authored-by: Josh Waldrep <joshua.waldrep5+github@gmail.com>
2026-01-14 11:20:10 +01:00
Mark Hendriksen
ae254434a1 Add primary text color to amount in header (#640)
* Add primary text color to amount in header

Applied the 'text-primary' class to the amount display in the valuations header for improved visual emphasis and consistency with the design system.

* Update header styles and add currency display

Applied 'text-primary' class to amount displays in trades and transfers headers for consistent styling. Added a secondary styled currency display to the valuations header for improved clarity.
2026-01-13 23:04:56 +01:00
LPW
ff55b977d4 Add sso_audit_logs association and clear logs in demo data cleaner (#638)
- Added `has_many :sso_audit_logs` association to `User` model with `dependent: :nullify`.
- Updated `Demo::DataCleaner` to clear SSO audit logs before destroying related data.

Co-authored-by: Josh Waldrep <joshua.waldrep5+github@gmail.com>
2026-01-13 17:44:51 +01:00
soky srm
0e22c60286 FIX Yahoo issues (#636)
* FIX Yahoo issues

* Update yahoo_finance_test.rb

* FIX proper cookie access
2026-01-13 16:46:07 +01:00
Juan José Mata
252042c0dc Fix account subtype not persisting when creating/editing investment accounts (#635)
The Account model only delegated the subtype reader to the accountable,
but not the writer. This caused form submissions with `account[subtype]`
to be silently ignored since there was no setter method on Account.

Changes:
- Add `subtype=` writer method to Account that delegates to accountable
- Add additional investment subtypes (457b, sep_ira, simple_ira, trust,
  ugma, utma, other) to Investment::SUBTYPES for better coverage
- Update PlaidAccount::TypeMappable with additional investment subtype
  mappings (403b, 457b, sep_ira, simple_ira, trust, ugma, utma)

Fixes #502

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-13 14:46:19 +01:00
Juan José Mata
88241cf5cb Fix tags getting removed after / during bank sync (#634)
* fix: Preserve transaction tags during rule application

When rules set tags, they now ADD to existing tags instead of replacing
them. This fixes issue #518 where tags were being removed during bank sync.

The root cause was that SetTransactionTags called enrich_attribute with
just the single tag from the rule, which replaced all existing tags.
Now it merges the new tag with existing tags using .uniq to prevent
duplicates.

This preserves:
- User-applied tags that shouldn't be overwritten by rules
- Tags from other rules when multiple rules match the same transaction
- Tags set during previous syncs

* fix: Add nil guard for tag in SetTransactionTags

Return early with 0 if the tag is not found, preventing NoMethodError
when find_by_id returns nil. This matches the pattern used in
SetTransactionMerchant.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-13 14:33:46 +01:00
soky srm
0bf3084738 Merge pull request #508 from kysre/add-config-import-csv-skip-first-x-rows
Add config import csv skip first x rows
2026-01-13 14:05:01 +01:00
sokie
11a011db15 Update import.rb 2026-01-13 13:51:10 +01:00
sokie
c9b334ac4f Add rows validation 2026-01-13 13:50:12 +01:00
sokie
30d3ee167e FIX add debounce for field
and refresh only form update
2026-01-13 13:45:40 +01:00