mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
feat(analytics): serve trending packages from persisted downloads
Trending read the in-memory analytics engine, which restarts empty. The endpoint now ranks packages by the last 7 days of stored downloads and reports the previous 7 days for the change. It counts a Go module once and skips metadata entries. A daily time_bucket index serves the range read. The Overview panel shows the change and no longer says the data resets on restart.
This commit is contained in:
@@ -238,8 +238,8 @@ func (DownloadStatsHourlyModel) TableName() string {
|
||||
|
||||
// DownloadStatsDailyModel represents pre-aggregated daily statistics
|
||||
type DownloadStatsDailyModel struct {
|
||||
TimeBucket time.Time `gorm:"not null;index:idx_stats_daily_composite,priority:2"` // Truncated to day
|
||||
PackageID *int64 `gorm:"index:idx_stats_daily_package"` // NULL = all packages in registry
|
||||
TimeBucket time.Time `gorm:"not null;index:idx_stats_daily_composite,priority:2;index:idx_stats_daily_time"` // Truncated to day
|
||||
PackageID *int64 `gorm:"index:idx_stats_daily_package"` // NULL = all packages in registry
|
||||
TopUserAgents JSONBField // Top 10 user agents
|
||||
|
||||
BaseModel
|
||||
|
||||
Reference in New Issue
Block a user