Investment Roadmap: 5 display and data issues #17
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_biz#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The investment roadmap tab has several functional, UX, and data-integrity issues.
1. Broken company link when company is not found
File:
crates/hero_biz_ui/src/web/templates/mod.rs~line 5164The format string unconditionally renders an
<a>tag for the company even when no company is linked to the transaction. WhencompanyisNone,company_idresolves to an empty string, producing:Fix: render plain text
"-"when there is no company, only a link whencompany_idis non-empty.2. Empty state: blank timeline when no investments exist
File:
crates/hero_biz_ui/src/web/templates/mod.rs~line 5274When there are no investment transactions, the
.timelinediv renders completely empty. The user just sees an empty card body with no message.Fix: show a friendly empty-state message when
timeline_itemsis empty.3.
instrumentsloaded but never usedHandler:
crates/hero_biz_ui/src/web/handlers/mod.rs~line 5227Template:
crates/hero_biz_ui/src/web/templates/mod.rsstructInvestmentRoadmapTemplateThe handler fetches all instruments from the store and passes them into the template struct, but
render()never referencesself.instruments. This is an unnecessary data-store round-trip.Fix: remove the
instrumentsfield fromInvestmentRoadmapTemplateand remove theload_all_instruments_for_spacecall from the handler.4. Mixed-currency cumulative total is misleading
File:
crates/hero_biz_ui/src/web/templates/mod.rs~line 5113cumulative_investedsums all investment amounts regardless of currency, buttotal_currencyjust stores the last transaction's currency. If investments exist in EUR and USD the displayed cumulative total and summary card are wrong.Fix: group amounts by currency and either (a) display per-currency totals, or (b) skip multi-currency summing and show each currency separately in the summary card.
Files to Change
crates/hero_biz_ui/src/web/templates/mod.rs— issues 1, 2, 4crates/hero_biz_ui/src/web/handlers/mod.rs— issue 3Implementation Spec for Issue #17
Objective
Fix four distinct bugs in the investment roadmap feature: a broken HTML anchor rendered even when no company is linked, a blank timeline when no investment transactions exist, dead code from an unused
instrumentsfield being fetched and stored, and a misleading mixed-currency cumulative total that collapses amounts across different currencies.Files to Modify
crates/hero_biz_ui/src/web/templates/mod.rs— Issues 1, 2, 4crates/hero_biz_ui/src/web/handlers/mod.rs— Issue 3Requirements
companyisNone), render the plain string"-"instead of<a href="/c/{context}/companies/">-</a>.timeline_itemsis empty after processing all transactions, render a visible empty-state message inside the.timelinediv instead of leaving it blank.instrumentsfield fromInvestmentRoadmapTemplateand remove theload_all_instruments_for_spacecall from theinvestment_roadmaphandler.cumulative_invested: f64+total_currency: Stringpair with aBTreeMap<String, f64>that accumulates amounts per currency key. In the "Total Invested" summary card, display per-currency lines derived from that map.Implementation Plan
Step 1 — Remove
instrumentsfromInvestmentRoadmapTemplate(templates/mod.rs)File:
crates/hero_biz_ui/src/web/templates/mod.rs~line 5169–5178Remove the field
pub instruments: Vec<Instrument>,from the struct. After the edit the struct body is:Dependencies: Must be done before Step 2.
Step 2 — Remove
instrumentsfetch from the handler (handlers/mod.rs)File:
crates/hero_biz_ui/src/web/handlers/mod.rs~line 5227–5231Remove the
load_all_instruments_for_spacecall and removeinstruments,from the struct instantiation.Dependencies: Step 1 must be complete first.
Step 3 — Fix broken company anchor when company is None (templates/mod.rs)
File:
crates/hero_biz_ui/src/web/templates/mod.rs~line 5244Compute
company_htmlbefore theformat!call:Replace the anchor line in the format string with
{company_html}and remove thecompany_idargument from theformat!call.Dependencies: None.
Step 4 — Multi-currency cumulative tracking (templates/mod.rs)
File:
crates/hero_biz_ui/src/web/templates/mod.rs~lines 5188–5370cumulative_invested: f64+total_currency: Stringwithcumulative_by_currency: BTreeMap<String, f64>.*cumulative_by_currency.entry(tx.currency.clone()).or_insert(0.0) += tx.amount;*cumulative_by_currency.get(&tx.currency).unwrap_or(&0.0).total_invested_htmljoining per-currency"{amt:.0} {CUR}"lines with<br>and use it in the summary card.Dependencies: None — independent of Steps 1–3.
Step 5 — Empty-state message when no investments exist (templates/mod.rs)
File:
crates/hero_biz_ui/src/web/templates/mod.rs~line 5350Build
timeline_html:Replace
timeline_items = timeline_items.join("\n")argument withtimeline_items = timeline_html.Dependencies: None.
Acceptance Criteria
<a>link in the timeline card."-"with no anchor tag.{amount} {CURRENCY}.InvestmentRoadmapTemplatehas noinstrumentsfield.investment_roadmaphandler makes no call toload_all_instruments_for_space.cargo checkpasses with no errors or new warnings.Notes
Transaction.currencyis a plainString(defaulting to"eur"). Use.to_uppercase()for display.BTreeMap(notHashMap) for stable alphabetical iteration order.investment_dashboardhandler also loadsinstruments— do NOT touch that handler; onlyinvestment_roadmapis in scope.Test Results
cargo check: passedTests
Details
All crates compiled cleanly. One unit test ran in
hero_biz_ui:The remaining crates (
hero_biz,hero_biz_app,hero_biz_sdk) have no tests defined yet.Branch:
development_casperImplementation Complete
All four bugs in the investment roadmap tab have been fixed.
Changes Made
crates/hero_biz_ui/src/web/templates/mod.rsinstrumentsfield fromInvestmentRoadmapTemplatestruct"-"instead of a broken empty anchor tagcumulative_invested + total_currencypair with aBTreeMap<String, f64>that tracks running totals per currency; the "Total Invested" summary card now displays one line per currency; per-card "Cumulative:" reflects only same-currency amountscrates/hero_biz_ui/src/web/handlers/mod.rsload_all_instruments_for_spacecall from theinvestment_roadmaphandler (the instruments data was never used)Test Results
cargo check: passed (all 4 workspace crates compiled cleanly)cargo test: 1/1 passed, 0 failures