Repository navigation
Re-organize packages - #4
Merged
Merged
Conversation
These queries only exist to service api v1 endpoints, so make it clear in package heirarchy.
raymondjacobson
approved these changes
Apr 3, 2025
dylanjeffers
added a commit
that referenced
this pull request
Nov 12, 2026
…1071) ## Why Michael approved idea #5 from the new-notification list (2026-11-11): tell artists when they chart in their genre, e.g. "[track] is #4 in Dubstep this week". It reaches many more artists than overall trending. His rule: only genres with at least 10 tracks on the chart that week. ## What - **`TrendingGenreNotificationsJob`** (indexer, every minute). - **Chart** is the live week ranking in `track_trending_scores` (what `/tracks/trending?genre=` serves), version `pnagD`, genre-carrying rows only. Tracks that are deleted, unlisted or unavailable, or whose owner is deactivated, are dropped before ranking. - **Rules:** top 10 per genre, genre must have at least 10 tracks on the chart. Tracks that already got an overall `trending` notification that day are skipped so nobody gets two pushes for one track. - **Timing:** one snapshot per week on Friday (the day trending winners are picked), sent from 18:00 UTC for 24h. Stage sends any day, keyed by the latest Friday. - **Once per week:** scores recompute hourly, so the insert runs under an advisory lock and stops if any row for that Friday exists. `group_id = trending_genre:<YYYY-MM-DD>:<track_id>`, `specifier = track_id`. - **Data:** `{track_id, genre, rank, week}`. - New type rather than reusing `trending` with a genre: older app builds render `trending` as "#4 on Trending", which would be wrong for a genre rank. It also doesn't depend on the trending reward challenge, which is being retired with $AUDIO rewards. - `trending_genre` added to the notifications `types` filter and swagger. No migration. ## Rollout Merging only writes rows. The push stays off until `push_trending_genre` is set in Optimizely (pedalboard PR), and the tile is behind the `trending_genre_notification` flag (apps PR). Clients without the apps PR drop the row in the adapter. ## Tests `go test ./jobs/ -run TrendingGenre` and `go test ./api/ -run Notification` pass. Cases: ranks after dropping unlisted and deactivated tracks, the 10-track minimum (9-track genre gets nothing, exactly 10 qualifies), skipping tracks already notified for overall trending, ignoring month and genre-less rows, one snapshot per week even when scores move, the next Friday, send window edges and stage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
queriestoapi/dbv1package and move sql files toapi/dbv1/queriesdirectory.These queries only exist to service api v1 endpoints, so make it clear in package hierarchy.