[bug] Project detail: linked stories not loaded or displayed #32

Closed
opened 2026-05-05 08:07:03 +00:00 by casper-stevens · 4 comments
Member

Context

Identified in home#211: project detail view cannot display linked stories.

Current state

projects_detail handler (handlers/mod.rs:4778) loads milestones and tasks for the project but does not call get_stories_for_project (or equivalent). ProjectDetailTemplate has no stories field. Stories with story_sid == project.sid are never fetched.

Fix

  1. Add get_stories_for_project(context, project_id) to services/mod.rs (filtering load_all_stories_for_space by story.project_sid)
  2. Call it in projects_detail handler and pass stories: Vec<Story> to ProjectDetailTemplate
  3. Add a Stories section to the project detail template listing story name, status, points, and a link to the story detail (once story routes exist — see related issue)

Dependency

Full story detail links require story routes to be added first. The stories list panel in project detail can be added independently.

## Context Identified in home#211: project detail view cannot display linked stories. ## Current state `projects_detail` handler (`handlers/mod.rs:4778`) loads milestones and tasks for the project but **does not** call `get_stories_for_project` (or equivalent). `ProjectDetailTemplate` has no `stories` field. Stories with `story_sid == project.sid` are never fetched. ## Fix 1. Add `get_stories_for_project(context, project_id)` to `services/mod.rs` (filtering `load_all_stories_for_space` by `story.project_sid`) 2. Call it in `projects_detail` handler and pass `stories: Vec<Story>` to `ProjectDetailTemplate` 3. Add a Stories section to the project detail template listing story name, status, points, and a link to the story detail (once story routes exist — see related issue) ## Dependency Full story detail links require story routes to be added first. The stories list panel in project detail can be added independently.
Author
Member

Implementation Spec for Issue #32

Objective

Display all stories linked to a project on the project detail page. Stories are already modelled, stored, and queryable — the project detail handler simply never fetches them and the template has no field or rendering block for them.

Requirements

  1. get_stories_for_project already exists in services/mod.rs and is correct. No new service function is needed.
  2. The projects_detail handler must call get_stories_for_project and pass the result to the template.
  3. ProjectDetailTemplate must gain a stories: Vec<Story> field.
  4. The render() method of ProjectDetailTemplate must produce a Stories section in the HTML, following the same visual pattern as the existing Milestones and Tasks sections.
  5. Story detail routes already exist (/c/:context/stories/:id), so story links are safe to emit now.

Files to Modify

  • crates/hero_biz_ui/src/web/templates/mod.rs — Add stories field to ProjectDetailTemplate; add Stories section in render()
  • crates/hero_biz_ui/src/web/handlers/mod.rs — Call get_stories_for_project in projects_detail handler and pass stories to template

Implementation Plan

Step 1 — Add stories: Vec<Story> field to ProjectDetailTemplate

File: crates/hero_biz_ui/src/web/templates/mod.rs

Add stories: Vec<Story> after tasks and before comments in the struct definition.

Step 2 — Add Stories rendering block in ProjectDetailTemplate::render()

File: crates/hero_biz_ui/src/web/templates/mod.rs

In the render() method:

  • Build a stories_rows string (iterate self.stories, format each as a table row with name (linked), status, story points)
  • Add a Stories <div class="subgrid"> section in the HTML output, after Tasks and before comments, showing a table of stories

Step 3 — Fetch stories in the projects_detail handler

File: crates/hero_biz_ui/src/web/handlers/mod.rs

  • Call state.store.get_stories_for_project(&context, &id).await.unwrap_or_default() after fetching tasks
  • Add stories to the ProjectDetailTemplate { ... } initialiser

Acceptance Criteria

  • cargo build completes without errors
  • Project detail page renders a "Stories" section below Tasks with name, status, and points columns
  • Story names link to /c/<context>/stories/<story_sid>
  • Projects with no stories show a count of 0 and an empty table (no panic)
  • Projects with stories having story_points: None display "-" in the Points column
  • Milestones and Tasks sections are visually unchanged

Notes

  • get_stories_for_project at services/mod.rs is already implemented and correct
  • Story is re-exported via crate::models::* — no new use statements needed
  • StoryStatus implements Display producing lowercase strings
  • Story detail routes are fully registered in the router
## Implementation Spec for Issue #32 ### Objective Display all stories linked to a project on the project detail page. Stories are already modelled, stored, and queryable — the project detail handler simply never fetches them and the template has no field or rendering block for them. ### Requirements 1. `get_stories_for_project` already exists in `services/mod.rs` and is correct. No new service function is needed. 2. The `projects_detail` handler must call `get_stories_for_project` and pass the result to the template. 3. `ProjectDetailTemplate` must gain a `stories: Vec<Story>` field. 4. The `render()` method of `ProjectDetailTemplate` must produce a Stories section in the HTML, following the same visual pattern as the existing Milestones and Tasks sections. 5. Story detail routes already exist (`/c/:context/stories/:id`), so story links are safe to emit now. ### Files to Modify - `crates/hero_biz_ui/src/web/templates/mod.rs` — Add `stories` field to `ProjectDetailTemplate`; add Stories section in `render()` - `crates/hero_biz_ui/src/web/handlers/mod.rs` — Call `get_stories_for_project` in `projects_detail` handler and pass `stories` to template ### Implementation Plan #### Step 1 — Add `stories: Vec<Story>` field to `ProjectDetailTemplate` File: `crates/hero_biz_ui/src/web/templates/mod.rs` Add `stories: Vec<Story>` after `tasks` and before `comments` in the struct definition. #### Step 2 — Add Stories rendering block in `ProjectDetailTemplate::render()` File: `crates/hero_biz_ui/src/web/templates/mod.rs` In the `render()` method: - Build a `stories_rows` string (iterate `self.stories`, format each as a table row with name (linked), status, story points) - Add a Stories `<div class="subgrid">` section in the HTML output, after Tasks and before comments, showing a table of stories #### Step 3 — Fetch stories in the `projects_detail` handler File: `crates/hero_biz_ui/src/web/handlers/mod.rs` - Call `state.store.get_stories_for_project(&context, &id).await.unwrap_or_default()` after fetching tasks - Add `stories` to the `ProjectDetailTemplate { ... }` initialiser ### Acceptance Criteria - [ ] `cargo build` completes without errors - [ ] Project detail page renders a "Stories" section below Tasks with name, status, and points columns - [ ] Story names link to `/c/<context>/stories/<story_sid>` - [ ] Projects with no stories show a count of 0 and an empty table (no panic) - [ ] Projects with stories having `story_points: None` display "-" in the Points column - [ ] Milestones and Tasks sections are visually unchanged ### Notes - `get_stories_for_project` at `services/mod.rs` is already implemented and correct - `Story` is re-exported via `crate::models::*` — no new `use` statements needed - `StoryStatus` implements `Display` producing lowercase strings - Story detail routes are fully registered in the router
Author
Member

Build Results

  • Status: PASS
  • Branch: development_casper
  • Command: cargo build (dev profile)
  • Duration: 25.17s
  • Output: Compiling hero_biz_ui v0.5.0, Finished dev profile [unoptimized + debuginfo]
## Build Results - Status: PASS - Branch: development_casper - Command: cargo build (dev profile) - Duration: 25.17s - Output: Compiling hero_biz_ui v0.5.0, Finished dev profile [unoptimized + debuginfo]
Author
Member

Implementation Summary

Fixed the missing stories section on the project detail page. Stories are linked to projects via project_sid and are independent of tasks.

Changes

crates/hero_biz_ui/src/web/handlers/mod.rs

  • Added get_stories_for_project call in projects_detail handler (after tasks fetch)
  • Added stories field to ProjectDetailTemplate initialiser

crates/hero_biz_ui/src/web/templates/mod.rs

  • Added pub stories: Vec<Story> field to ProjectDetailTemplate struct
  • Added stories_rows builder in render() — iterates stories, produces linked table rows with name, status, and story points (falls back to "-" if None)
  • Added Stories section (<div class="subgrid">) in the HTML output, positioned after Tasks and before comments

Build

  • cargo build passed, no errors or warnings
## Implementation Summary Fixed the missing stories section on the project detail page. Stories are linked to projects via `project_sid` and are independent of tasks. ### Changes **`crates/hero_biz_ui/src/web/handlers/mod.rs`** - Added `get_stories_for_project` call in `projects_detail` handler (after tasks fetch) - Added `stories` field to `ProjectDetailTemplate` initialiser **`crates/hero_biz_ui/src/web/templates/mod.rs`** - Added `pub stories: Vec<Story>` field to `ProjectDetailTemplate` struct - Added `stories_rows` builder in `render()` — iterates stories, produces linked table rows with name, status, and story points (falls back to "-" if None) - Added Stories section (`<div class="subgrid">`) in the HTML output, positioned after Tasks and before comments ### Build - `cargo build` passed, no errors or warnings
Author
Member

Fixed in feb9680.

Fixed in feb9680.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_biz#32
No description provided.