Skip to content

API call counts just under a magnitude display as 1000K #8803

Open

Description

@RaphaelFakhri

How are you running Flagsmith

  • Self Hosted with Docker
  • Self Hosted with Kubernetes
  • SaaS at flagsmith.com
  • Some other way (add details in description below)

Describe the bug

Found in the frontend source on main. The usage page and the organisation API limit banner shorten API call counts with Format.shortenNumber. When a count rounds up to the next magnitude, the shortened value keeps the smaller suffix:

Count Displayed Expected
999,950 1000K 1M
999,999 1000K 1M
999,950,000 1000M 1B

This is most visible for an organisation close to a 1M limit, where the usage meter reads 1000K / 1M.

Steps To Reproduce

  1. In the frontend, call Format.shortenNumber(999950) from common/utils/format.ts.
  2. The result is 1000K.

Expected behavior

The value moves to the next suffix after rounding, so 999950 displays as 1M.

Screenshots

No response

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions