Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix holding name error #1113

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
web: bin/rails server -b 0.0.0.0
web: ${DEBUG:+rdbg -O -n -c --} bin/rails server -b 0.0.0.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Optionally, run DEBUG=true bin/dev to start the dev server with a debugging port open, which VSCode (or another editor) can use to hook into the debug gem (installed with project already)

For example, with Ruby LSP plugin in VSCode, use this launch setting to attach to the running dev process:

    {
      "type": "ruby_lsp",
      "name": "Attach debugger",
      "request": "attach"
    }

css: bin/rails tailwindcss:watch
worker: bundle exec good_job start
5 changes: 4 additions & 1 deletion app/models/account/holding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ class Account::Holding < ApplicationRecord
scope :known_value, -> { where.not(amount: nil) }
scope :for, ->(security) { where(security_id: security).order(:date) }

delegate :name, to: :security
delegate :ticker, to: :security

def name
security.name || ticker
end

def weight
return nil unless amount

Expand Down
6 changes: 4 additions & 2 deletions app/views/account/holdings/_holding.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<%= turbo_frame_tag dom_id(holding) do %>
<div class="grid grid-cols-12 items-center text-gray-900 text-sm font-medium p-4">
<div class="col-span-4 flex items-center gap-4">
<%= render "shared/circle_logo", name: holding.name || "H" %>
<%= render "shared/circle_logo", name: holding.name %>

<div class="space-y-0.5">
<%= link_to holding.name || holding.ticker, account_holding_path(holding.account, holding), data: { turbo_frame: :drawer }, class: "hover:underline" %>
<%= link_to holding.name, account_holding_path(holding.account, holding), data: { turbo_frame: :drawer }, class: "hover:underline" %>

<% if holding.amount %>
<%= tag.p holding.ticker, class: "text-gray-500 text-xs uppercase" %>
<% else %>
Expand Down