8000 Deals have no stage-entry timestamp, so "rotten" can only be approximated from updated_at · Issue #12 · iblai/crm · GitHub
[go: up one dir, main page]

Skip to content

Deals have no stage-entry timestamp, so "rotten" can only be approximated from updated_at #12

Open

Description

@mamigot

What the CRM needs

When a deal entered its current stage. Pipelines carry rotten_days ("days a Deal can sit in a stage before it's surfaced as stale", iblai-api-crm → references/schema.md), but no field records how long a deal has actually sat there.

Workaround in the code right now

components/crm/deals/deal-board.tsx:27-31 flags a card stale when Date.now() - deal.updated_at > rotten_days. updated_at moves on any write — editing the description, attaching a tag, changing the owner — so a deal stuck in Proposal for 90 days that someone re-tagged yesterday shows as fresh.

Also blocks

Time-in-stage and stage-velocity reporting. The only stage history is the audit Activity each move writes (type=note, title "Stage changed", from→to in free-text comment), which a client would have to fetch per deal and parse.

Proposal

Read-only stage_entered_at on Deal, stamped by move-stage/, won/, lost/, and ideally a structured stage-history read (GET /api/crm/deals/{id}/stage-history/ → [{from_stage, to_stage, at, by}]) instead of parsing note text.

Activity

  1. added
    api-gap
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-gap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0