Skip to content

feat(events): sort remix-contests by open/ended × audius-followed, entries desc#845

Merged
dylanjeffers merged 1 commit into
mainfrom
feat/remix-contests-audius-follows-sort
May 22, 2026
Merged

feat(events): sort remix-contests by open/ended × audius-followed, entries desc#845
dylanjeffers merged 1 commit into
mainfrom
feat/remix-contests-audius-follows-sort

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

Reworks the ordering on GET /v1/events/remix-contests to a four-group sort, then entry_count DESC inside each group:

  1. Open contests whose host is followed by the Audius account
  2. Open contests whose host is not followed by the Audius account
  3. Ended contests whose host is followed by the Audius account
  4. Ended contests whose host is not followed by the Audius account

The Audius account is still configured via config.Cfg.FeaturedAudienceUserID (env: featuredAudienceUserId). When it is 0, the follow-based tiebreak collapses and the list reduces to open-before-ended (still entry_count DESC inside each block).

This replaces the previous "featured user first → has-entries next → ended-empty last" ordering.

Changes

  • api/v1_events_remix_contests.go — new ORDER BY: open-vs-ended → audius-followed-vs-not (via EXISTS on follows with is_current = true AND is_delete = false) → entry_count DESC → existing end_date / event_id tiebreaks. Doc comment updated.
  • config/config.go — updated the FeaturedAudienceUserID comment to reflect its new role (follow-based promotion, not direct contest featuring).
  • api/v1_events_remix_contests_test.go:
    • TestRemixContestsSortPriority rewritten with 8 events covering all 4 groups × high/low entry counts, plus a subtest that unsets FeaturedAudienceUserID and asserts the collapsed open-before-ended fallback.
    • New TestRemixContestsFollowFilterIgnoresStaleRows verifies that soft-deleted (is_delete=true) and non-current (is_current=false) follow rows do not promote a host into the followed sub-group.
    • TestRemixContestsDiscoveryPage is unchanged; its active-before-ended assertion still holds under the new sort.

Test plan

  • make test (or local equivalent) — TestRemixContestsDiscoveryPage, TestRemixContestsSortPriority, TestRemixContestsFollowFilterIgnoresStaleRows
  • Spot-check /v1/events/remix-contests against a staging dataset with featuredAudienceUserId set to the Audius account, confirming followed hosts surface first inside both the open and ended blocks.
  • Spot-check with featuredAudienceUserId=0 to confirm the open/ended split + entry_count DESC still applies.

🤖 Generated with Claude Code

…tries desc

Replaces the prior "featured user first, has-entries next, ended-empty last"
ordering on GET /v1/events/remix-contests with four explicit groups:

  1. Open contests whose host is followed by the Audius account
  2. Open contests whose host is not followed by the Audius account
  3. Ended contests whose host is followed by the Audius account
  4. Ended contests whose host is not followed by the Audius account

Within each group, results sort by entry_count DESC, then by the existing
end_date tiebreak, then event_id ASC for stability. The Audius account is
still controlled by config.Cfg.FeaturedAudienceUserID; when it is 0 the
follow tiebreak collapses and the list reduces to open-before-ended.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dylanjeffers dylanjeffers merged commit d1136bd into main May 22, 2026
5 checks passed
@dylanjeffers dylanjeffers deleted the feat/remix-contests-audius-follows-sort branch May 22, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant