Skip to content

fix(account): show activity label for accounts supporting trades#1993

Open
xBlaz3kx wants to merge 1 commit into
we-promise:mainfrom
xBlaz3kx:fix/activity-row-fix
Open

fix(account): show activity label for accounts supporting trades#1993
xBlaz3kx wants to merge 1 commit into
we-promise:mainfrom
xBlaz3kx:fix/activity-row-fix

Conversation

@xBlaz3kx
Copy link
Copy Markdown
Contributor

@xBlaz3kx xBlaz3kx commented May 25, 2026

Summary

Previously, the account chart view selector (holdings/cash/total value) and the transaction activity badge were gated behind account.investment?. This excluded crypto exchange accounts (Coinbase, Kraken, etc.) which also support trades via supports_trades?.

Changes

  • account/chart.html.erb: Replace investment? with supports_trades? for the chart view selector and holdings value tooltip
  • transactions/_transaction.html.erb: Replace investment? with supports_trades? for showing the activity label badge instead of a category label

Behavior

  • supports_trades? returns true for all investment accounts (unchanged) and for crypto accounts with subtype exchange
  • Crypto wallet/other subtypes are unaffected — they continue showing categories

Summary by CodeRabbit

  • Refactor
    • Updated account chart and transaction views to display trade-related UI elements based on refined account capability detection. Chart tooltips and activity labels now render according to account trade support status.

Review Change Stack

@xBlaz3kx xBlaz3kx marked this pull request as ready for review May 25, 2026 21:14
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6a4ad28f-bda2-4284-8146-2fb9e9835e63

📥 Commits

Reviewing files that changed from the base of the PR and between d8a12ad and 63cdcfb.

📒 Files selected for processing (2)
  • app/components/UI/account/chart.html.erb
  • app/views/transactions/_transaction.html.erb

📝 Walkthrough

Walkthrough

Three view templates switch their account-type conditionals from account.investment? to account.supports_trades? to gate trade-related UI elements (chart tooltips, chart-view selector, and transaction activity labels) across the account and transaction views.

Changes

Account Type Gating Update

Layer / File(s) Summary
Chart tooltip and selector gating
app/components/UI/account/chart.html.erb
Conditional rendering for the value tooltip wrapper and chart-view dropdown selector is updated to check account.supports_trades? instead of account.investment?.
Transaction activity label gating
app/views/transactions/_transaction.html.erb
Conditional rendering for the investment/crypto activity quick-edit badge is updated to check entry.account.supports_trades? instead of entry.account.investment? for non-transfer transactions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • we-promise/sure#649: Both PRs adjust the investment-activity/quick-edit UI rendering conditions in transaction-related views, aligning template changes with trade support predicate introduction.

Suggested reviewers

  • jjmata
  • luckyPipewrench

Poem

🐰 A rabbit hops through views with glee,
Swapping investment? for supports_trades? spree,
Chart tooltips and badges now align,
Account type checks now feel divine!
Small changes, smooth flow—a template refine! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating UI logic to show activity labels for accounts supporting trades, replacing the previous investment-only condition.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis. and removed contributor:verified Contributor passed trust analysis. labels May 25, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63cdcfb43b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

<div class="hidden md:flex min-w-0 items-center gap-1 col-span-2">
<% if entry.account.investment? && !transaction.transfer? %>
<%# For investment accounts, show activity label instead of category %>
<% if entry.account.supports_trades? && !transaction.transfer? %>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard activity badge until Buy/Sell conversion supports crypto

Rendering investment_activity/quick_edit_badge for all supports_trades? accounts introduces a broken interaction for crypto exchange transactions: the badge’s JS routes Buy/Sell selections to convert_to_trade (app/javascript/controllers/activity_label_quick_edit_controller.js), but TransactionsController#convert_to_trade still rejects non-investment? accounts (app/controllers/transactions_controller.rb). As a result, crypto users now see the activity badge but hit an error path when choosing the two most common labels, which is a regression from the previous category-only UI.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

jjmata commented May 26, 2026

Simple and correct. supports_trades? is the right predicate — it covers all investment accounts (unchanged) plus crypto exchange accounts (the previously-missing case).

Two touch-points changed:

  1. Chart view selector (holdings/cash/total value tabs) — crypto exchange accounts will now see the three-view selector, which is correct since they track holdings.
  2. Transaction activity badge — crypto exchange accounts will show the activity label instead of a category label, consistent with how investment accounts behave.

Crypto wallet and other crypto subtypes are unaffected since supports_trades? returns false for them.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-gittensor pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants