Skip to content

"24h" labels across multiple pages show calendar-day data, not rolling 24-hour window #597

@ianakiara

Description

@ianakiara

Summary

Multiple pages display stats labeled as "24h" but the underlying data represents calendar-day buckets (midnight-to-midnight), not a rolling 24-hour window. In some cases, the data shown is the day before yesterday, not even yesterday.

Affected Pages

1. Blocks Page (/blocks)

File: src/pages/blocks/index.tsx (lines 192, 208, 229)

Three card headers — "Blocks 24h", "Rewards 24h", "Burned 24h" — display values from blocksStatsYesterday, which is fed by yesterdayStatisticsCall().

File: src/services/apiCalls.ts (lines 21-31)

export const yesterdayStatisticsCall = async (): Promise<IBlockStats> => {
  const res = await api.get({
    route: 'block/statistics-by-day/1',
  });
  return res.data.block_stats_by_day[0];
};

The endpoint block/statistics-by-day/1 returns yesterday's completed calendar day, not a rolling 24h window.

2. Home Page

File: src/components/Home/CardDataFetcher/HomeDataCards/index.tsx (lines 123-125, 155)

variation: `+ ${(
  newTransactions + (beforeYesterdayTransactions ?? 0)
).toLocaleString()}`,
// ...
<p>{variation}/24h</p>

Sums lastDaysTransactionCount[0] + lastDaysTransactionCount[1] from the node/aggregate endpoint — two full calendar days — and labels the result "/24h". This overstates the value by ~2x compared to a true 24h count.

3. Accounts Page (/accounts)

File: src/pages/accounts/index.tsx (lines 83-87, 108, 128)

route: 'address/list/count/1',
// ...
setCreatedYesterday(value.data.number_by_day[0]?.doc_count);
// ...
t('accounts:AccountsPage.Accounts created in the last 24h'),

The i18n label explicitly says "last 24h" but the data comes from address/list/count/1, which returns number_by_day[0] — a calendar-day bucket for yesterday.

4. Smart Contracts Page (worst case)

File: src/components/SmartContracts/SmartContractTopCard/index.tsx (lines 27, 53)

variation: `+ ${(beforeYesterdayTransactions ?? 0).toLocaleString()}`,
// ...
<p>{variation}/24h</p>

File: src/services/requests/smartContracts/index.ts (lines 122-131)

route: 'transaction/list/count/2',
// ...
beforeYesterdayTxs: res.data?.number_by_day[1]?.doc_count || 0,

Fetches transaction/list/count/2, extracts index [1] — the day before yesterday — and displays it as "/24h". This is the most misleading instance: users see data that can be up to ~72 hours stale.

Root Cause

The upstream Klever API endpoints (block/statistics-by-day, address/list/count, transaction/list/count) only provide calendar-day buckets. No rolling 24h endpoint exists.

Impact

Users expect "24h" to mean "the last 24 hours from now." Instead they get yesterday's (or day-before-yesterday's) calendar-day stats, which can be 24-72 hours stale depending on the current time of day.

Options

  1. Fix labels — Rename "24h" → "Yesterday" across all affected pages. Quick, accurate.
  2. Fix data — Implement rolling 24h aggregation (new upstream API endpoint or proxy in kleverscan-api). Correct UX, requires backend work.
  3. Both — Fix labels now, implement true 24h data as follow-up.

Related

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