Comfy-Org / Comfy-Org/download-data

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

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
4
Forks
4
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.