Skip to content

[#957] Add Market Cap sort option#969

Merged
realproject7 merged 2 commits intomainfrom
task/957-mcap-sort
Apr 23, 2026
Merged

[#957] Add Market Cap sort option#969
realproject7 merged 2 commits intomainfrom
task/957-mcap-sort

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Adds "Market Cap" sort option to the FilterBar dropdown (alongside Recent and Trending)
  • New getMcapStorylines() in lib/ranking.ts computes MCap as totalSupply × pricePerToken × PLOT/USD using batch multicall + cached USD price
  • MCap sort uses active-first ordering (consistent with Trending per [Feature] Active story badges + active-first sorting on Trending/MCap #958)
  • Reuses existing fetchCandidatesAndRatings for candidate pool and getBatchTokenData for on-chain data

Fixes #957

Test plan

  • "Market Cap" appears in sort dropdown on desktop and mobile
  • Selecting Market Cap sorts stories by MCap descending
  • Active stories appear above completed/expired in MCap sort
  • Recent and Trending sorts unaffected
  • Works with writer/genre/language filters applied

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Apr 23, 2026 10:26pm

Request Review

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES

Summary

The new Market Cap tab wiring is straightforward, but the ranking source is not actually global market-cap order. getMcapStorylines() reuses the recency-biased candidate pool from fetchCandidatesAndRatings(), so older high-cap stories can be omitted entirely from the sorted results.

Findings

  • [high] Market Cap sorting is computed over a limited recency/activity subset instead of the full discover set. getMcapStorylines() calls fetchCandidatesAndRatings(), and that helper only pulls up to 50 newest stories plus 50 recently-updated stories before sorting. As a result, a story with a top market cap can be missing from the Market Cap view if it is older and not recently active, which violates the requirement that stories be sorted by MCap descending.
    • File: lib/ranking.ts:293
    • Suggestion: Source the MCap ranking from the full filtered discover set (or a dedicated MCap candidate query), not the trending candidate pool optimized for recency/activity.

Decision

Requesting changes because the new sort order is incomplete and can return the wrong top stories for Market Cap.

…ubset

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The re-review update fixes the blocking Market Cap ranking issue by sourcing candidates from the full filtered story set instead of the recency/activity subset used for trending. The new sort option, page wiring, and active-first ordering now line up with the reviewed requirements.

Findings

  • No blocking findings.

Decision

Approving because the previous correctness issue in lib/ranking.ts is resolved and the Market Cap view now ranks the full eligible set by MCap descending with the intended active-first ordering. Checks visible to me were Vercel-only at review time.

@realproject7 realproject7 merged commit 8e43097 into main Apr 23, 2026
4 checks passed
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.

[Feature] Add Market Cap sort option to story discovery

2 participants