Skip to content

Home page "Reports" tile never shows the "+N this month" badge #201

Description

@AKercha1

What's wrong

On the home page, the "By the numbers" section shows a green "+N this month" badge on each tile. The Reports tile never shows one - even when reports are actively being added.

Reports tile has no "this month" badge

To be clear up front: no data is missing. The total count is correct and does update - the DB currently has 60 approved/visible reports and the page now shows 60 (the screenshot caught it at 58, just before two reports got approved). The bug is only the missing "+N this month" badge.

Why it happens

The "this month" number is calculated as "how many reports have a date within the last month":

// Backend/.../Data/Processors/ReportProcessor.cs  ->  GetStatisticsChanges()
var ago = DateTime.UtcNow.AddMonths(-1);
var newReports = await db.Report
    .Where(v => v.Status == ReportModelStatus.Approved && !v.IsHidden && !v.IsDeleted && v.Date >= ago)
    .CountAsync();

The catch: report.Date is the audit date typed in by whoever uploads the report — not the date the report was added to the portal. Audit reports are almost always dated more than a month before we publish them, so Date >= oneMonthAgo is basically never true. Result: the counter sits at 0 forever.

Two real examples from the reports added today:

  • Volta Wallet – Zellic - uploaded today, audit date Jan 30
  • Spectra Bridge – Certora - uploaded today, audit date May 1

Both brand new on the portal, both invisible to the "this month" counter.

The Vulnerabilities tile shows "+141 this month" and looks like it works - but only by accident. Vulnerability records get their date set to roughly when they're ingested (recent), while reports keep the real audit date (old). So the two tiles are measuring two different things.

Rough fix

The "new this month" metric should be based on when the report was added to the portal, not on the audit date.

Cleanest option:

  • Add a created_at column to the report table (set it on insert), and change GetStatisticsChanges() to filter on created_at >= ago instead of Date >= ago.

Quick-and-dirty option (no migration):

  • Filter on last_action_at >= ago instead. It's approximate (that field also moves whenever a report is edited/re-approved), but it's much closer to reality than the audit date.

While we're at it, it'd be worth making Vulnerabilities / Protocols / Auditors use the same "added to portal" date too, so all four tiles count the same way.

Affected code:

  • Backend/SorobanSecurityPortalApi/Data/Processors/ReportProcessor.csGetStatisticsChanges()
  • same pattern in VulnerabilityProcessor.cs (and the protocol/auditor equivalents)

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions