mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
Adds a dedicated NIP-88 poll results screen showing how many votes each option got and who voted for what, and fixes the tally bugs and the missing subscription it would otherwise have inherited. Tally is now poll-aware. PollTallyPolicy carries the kind-1068 rules — valid option codes, poll type, and the open window — into ResponseTally, which previously had no access to the poll it was counting. That fixes four things at once: single-choice polls now read only the first response tag instead of every one of them, unknown option codes no longer create phantom buckets that drag real percentages down, responses stamped outside the poll's window are excluded rather than winning on timestamp, and percentages divide by distinct voters instead of total selections. Responses routinely arrive before their poll, so the tally starts permissive and recomputes when updatePolicy lands; both caches set it from either arrival order. Percentages are now share-of-voters. Single choice is unchanged; on multiple choice a bar reads "7 in 10 people" and the bars can sum past 100%. Android now asks the poll's own relay tags for kind 1018. Votes are published there per NIP-88 and EventBroadcaster obeys that on the way out, but the engagement filter only queried the author's inbox relays and where the note was seen, so tallies were systematically short. Desktop had already patched this per-card. The screen itself reads that same tally off the poll Note — no new subscription, no second cache, so the feed card and the results page cannot disagree. Voter rows are UserLine unmodified, with the vote passed into the trailingContent slot it already exposes. Tapping an option scopes the list without moving the summary above it. Muted voters still count toward the totals but are not listed, and the footer accounts for every response excluded and why. Entry points: a vote count beside each percentage on the feed card, and a "N votes" link that opens the screen — so the avatar stack's "+N" is no longer a dead end. Desktop column, audience filter, sort, search and zap polls are not in this change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AQorYBSv9oMvKa8hF1uGBv