From c86817a00bb1529e1fd5e99eab0ad2d79c00b6cb Mon Sep 17 00:00:00 2001 From: Dylan Jeffers Date: Fri, 5 Jun 2026 14:22:39 -0700 Subject: [PATCH] fix(trending): use bare type strings in trending winners queries Change the trending_results.type filter values from the Python-style "TrendingType.TRACKS" / "TrendingType.UNDERGROUND_TRACKS" to the bare "TRACKS" / "UNDERGROUND_TRACKS" stored in the table, and update the test fixtures to match. Co-Authored-By: Claude Opus 4.8 (1M context) --- api/testdata/trending_results_fixtures.go | 12 ++++++------ api/v1_tracks_trending_underground_winners.go | 2 +- api/v1_tracks_trending_winners.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/testdata/trending_results_fixtures.go b/api/testdata/trending_results_fixtures.go index e0ed60d5..fbd51585 100644 --- a/api/testdata/trending_results_fixtures.go +++ b/api/testdata/trending_results_fixtures.go @@ -2,11 +2,11 @@ package testdata var TrendingResultsFixtures = []map[string]any{ // Week 2022-01-21 - tracks 300, 202, 200 (rank 1, 2, 3) - matches trending order - {"user_id": 3, "id": "300", "rank": 1, "type": "TrendingType.TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, - {"user_id": 2, "id": "202", "rank": 2, "type": "TrendingType.TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, - {"user_id": 2, "id": "200", "rank": 3, "type": "TrendingType.TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, + {"user_id": 3, "id": "300", "rank": 1, "type": "TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, + {"user_id": 2, "id": "202", "rank": 2, "type": "TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, + {"user_id": 2, "id": "200", "rank": 3, "type": "TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, // Week 2022-01-21 - underground tracks 519, 520, 521 (rank 1, 2, 3) - {"user_id": 8, "id": "519", "rank": 1, "type": "TrendingType.UNDERGROUND_TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, - {"user_id": 11, "id": "520", "rank": 2, "type": "TrendingType.UNDERGROUND_TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, - {"user_id": 1, "id": "521", "rank": 3, "type": "TrendingType.UNDERGROUND_TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, + {"user_id": 8, "id": "519", "rank": 1, "type": "UNDERGROUND_TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, + {"user_id": 11, "id": "520", "rank": 2, "type": "UNDERGROUND_TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, + {"user_id": 1, "id": "521", "rank": 3, "type": "UNDERGROUND_TRACKS", "version": "TrendingVersion.ML51L", "week": "2022-01-21"}, } diff --git a/api/v1_tracks_trending_underground_winners.go b/api/v1_tracks_trending_underground_winners.go index 72dba1e7..8fe5d655 100644 --- a/api/v1_tracks_trending_underground_winners.go +++ b/api/v1_tracks_trending_underground_winners.go @@ -43,7 +43,7 @@ func (app *ApiServer) v1TracksTrendingUndergroundWinners(c *fiber.Ctx) error { func (app *ApiServer) getTrendingUndergroundWinnersIds(c *fiber.Ctx, weekParam string) ([]int32, error) { args := pgx.NamedArgs{ - "type": "TrendingType.UNDERGROUND_TRACKS", + "type": "UNDERGROUND_TRACKS", } var weekFilter string diff --git a/api/v1_tracks_trending_winners.go b/api/v1_tracks_trending_winners.go index 8f189338..491a6e90 100644 --- a/api/v1_tracks_trending_winners.go +++ b/api/v1_tracks_trending_winners.go @@ -43,7 +43,7 @@ func (app *ApiServer) v1TracksTrendingWinners(c *fiber.Ctx) error { func (app *ApiServer) getTrendingWinnersIds(c *fiber.Ctx, weekParam string) ([]int32, error) { args := pgx.NamedArgs{ - "type": "TrendingType.TRACKS", + "type": "TRACKS", } var weekFilter string