mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-26 07:59:34 +00:00
fix(ui): correct rounding boundary comment from 999,500 to 999,950
This commit is contained in:
committed by
Vincent Koc
parent
5e602b1e06
commit
d191da1a66
@@ -20,7 +20,7 @@ describe("formatCompactTokenCount", () => {
|
||||
});
|
||||
|
||||
it("rolls values that round up to 1000.0k over into the M branch instead of showing 1000k", () => {
|
||||
// Regression test: 999,500-999,999 round to "1000.0" at one-decimal
|
||||
// Regression test: 999,950-999,999 round to "1000.0" at one-decimal
|
||||
// thousands precision. Before the fix, the >= 1_000_000 branch check
|
||||
// ran on the raw value (which is still < 1_000_000), so these fell
|
||||
// through to the k branch and displayed the nonsensical "1000k".
|
||||
|
||||
@@ -4,7 +4,7 @@ export function formatCompactTokenCount(tokens: number): string {
|
||||
return `${(tokens / 1_000_000).toFixed(1).replace(/\.0$/, "")}M`;
|
||||
}
|
||||
if (tokens >= 1_000) {
|
||||
// Values from 999,500-999,999 round to "1000.0" at one-decimal
|
||||
// Values from 999,950-999,999 round to "1000.0" at one-decimal
|
||||
// thousands precision, which would display the nonsensical "1000k"
|
||||
// instead of rolling over to the M branch above. Re-check the
|
||||
// rounded result before formatting.
|
||||
|
||||
Reference in New Issue
Block a user