Skip to content

Analytics undercounts states matched by name instead of group #389

Description

@cavidelizade

Summary

The analytics work-items page miscounts for any project that renames its states, because it matches on hardcoded English state names instead of the state group.

Where

apps/web/src/pages/AnalyticsWorkItemsPage.tsx. backlogCount/startedCount/unstartedCount/completedCount are computed by getStateName(...) === 'Backlog' | 'In Progress' | 'Todo' | 'Done', and doneStateIds by s.name === 'Done'. States carry a group field ('backlog'|'unstarted'|'started'|'completed'|'cancelled') that other pages use correctly (CyclesPage.getStateGroup). Any project with renamed or custom states (for example "In Review", "Ready") falls into none of the buckets, so every KPI, the projects table, and the Resolved line undercount. The Cancelled column is hardcoded to 0.

Secondary: the Created-vs-Resolved chart buckets "resolved" by updated_at, so a later edit to a completed issue moves its resolution date (same class as the cycle completion chart, #344).

Suggested fix

Bucket by state.group (map each issue's state_id to its group), not by the display name. For the resolved trend, key off an actual completion timestamp once one exists (see #344).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions