Bug: First observation of an asset inflates daily delta (re-uploads/new IDs)

Open Beginner friendly
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Domain
data

Research direction

Start in scripts/fetch-data.mjs around lines 346–357 and inspect the daily delta CASE expression, including similar uses elsewhere in the file. Verify that a missing prior snapshot contributes zero while later observations use the true difference. Done means newly appearing or re-uploaded assets no longer create one-day spikes and subsequent days report true diffs.

Written by the indexing model from the issue text.

Description

bug

Summary
Daily summary treats missing prior snapshot as if today’s full download_count is the delta, which can spike totals when an asset is first seen (including re-uploads with a new asset_id).

Evidence

  • CASE expression: scripts/fetch-data.mjs:346–357 (and similar) uses
    WHEN old.download_count IS NULL THEN new.download_count

Proposed Fix

  • Treat first observation as 0 delta:
    CASE WHEN old.download_count IS NULL THEN 0 ELSE new.download_count - old.download_count END
  • Alternatively detect first_seen date per asset_id (MIN(date)) and force 0 when new.date == first_seen.

Acceptance Criteria

  • Newly appearing assets no longer cause one-day spikes
  • Subsequent days reflect true diffs
Dominant language
TypeScript
Stars
4
Forks
4
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Comfy-Org/download-data

All issues in Comfy-Org/download-data

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.