Skip to content

feat(moderator): render aggregated results for warm-up and other question prompts - #241

Merged
jencompgeek merged 3 commits into
mainfrom
jh/pregame-mod
Nov 10, 2026
Merged

jencompgeek merged 3 commits into
mainfrom
jh/pregame-mod

Conversation

@jencompgeek

Copy link
Copy Markdown
Collaborator

What is in this PR?

Gives moderators a readable summary when participants answer a private prompt question — today,
that's always the pregame warm-up question, but the shape is generic enough to cover any future
poll-style prompt too. Instead of moderators having to piece together individual replies, they see
one card per question with each answer option's count, share of responses, and (for non-warm-up
questions only) a few example quotes illustrating that option.

Changes in the codebase

  • types.internal.ts: added ModeratorQuestionResultsMessage, a PseudonymousMessage extension for
    body.type === 'questionResults', carrying questionType, question, format ('text' |
    'singleChoice'), and a results array of { label, count, examples? }. questionType is read straight
    from whatever body.type the original prompt message used, so a new question kind never needs a
    parallel naming scheme kept in sync.
  • pages/moderator.tsx:
    • Widened the moderator message filter to also include message.body.type === 'questionResults'
      (previously only insights/metrics).
    • Added rendering for questionResults messages: a badge (Warm-up Results in green for questionType
      === 'warmUpQuestion', generic Question Results in indigo otherwise), the question text, and
      each result as a label/count/percentage bar.
    • Warm-up results never render the examples list, even when the message includes one — those are
      private prompt replies participants didn't agree to have quoted verbatim to a moderator.
      Non-warm-up question types still show example snippets per result when present.

Documentation and automated testing

Did you:

  • document any breaking changes in your commit messages?
  • document your changes as comments in the code? Use TSDoc format where appropriate.
  • update the README and docs to be clear and easy to use for end users and developers?
  • add and/or update automated tests?
  • update team documentation of any new or changed environment variables?
  • If openapi.json changed: names the llm_engine PR/commit it came from, and whether that backend change is deployed
  • add a What's New entry in content/whatsNew.ts for new features?

Testing this PR

  • Trigger (or mock) a questionResults moderator message with questionType: 'warmUpQuestion' and
    format: 'text', including an examples array on one result — confirm the card shows the green
    "Warm-up Results" badge, the question, each result's count/percentage bar, and no example quotes.
  • Do the same with a non-warm-up questionType (e.g. eventPoll) and confirm it instead shows the
    indigo "Question Results" badge and the example quotes.
  • Trigger one with format: 'singleChoice' and no examples on any result — confirm it renders
    cleanly with just labels/counts/bars.

Additional information

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
nextspace Ready Ready Preview Nov 10, 2026 5:12pm UTC

Request Review

@cbj0hns0n cbj0hns0n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works great! Might wanna look into the failing CI check?

…icate

The same three-clause filter (channel plus insights/metrics/
questionResults shape) was duplicated verbatim between the initial
fetch and the gap-reconnect refetch, so a future change to which
message shapes this view displays could be made in one and missed in
the other.
@jencompgeek
jencompgeek merged commit c930c04 into main Nov 10, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — ca26415e Deployed Nov 10, 2026 by vercel[bot]
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.

2 participants