Skip to content

fix(profile): correct debate type label and stray 0 in Debate Details - #821

Open
Furqan-7 wants to merge 1 commit into
AOSSIE-Org:mainfrom
Furqan-7:fix/debate-details-text
Open

Furqan-7 wants to merge 1 commit into
AOSSIE-Org:mainfrom
Furqan-7:fix/debate-details-text

Conversation

@Furqan-7

@Furqan-7 Furqan-7 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Addressed Issues:

Fixes #820

Screenshots/Recordings:

preview

Left: current main shows "User Vs_bot" and the summary ends with "The result was a win.0". Right: with this PR it shows "User vs Bot" and the summary ends at "win.". The profile response was mocked with the same format the profile API returns (debateType: "user_vs_bot", eloChange: 0).

Additional Notes:

Two small text bugs in the same dialog:

  1. debateType.replace("_", " ") only replaces the first underscore, so user_vs_bot became "user vs_bot". The Saved Transcripts viewer had the same label.
  2. {eloChange && eloChange !== 0 && (...)} returns 0 when the change is 0, and React prints that 0. The profile API currently sends eloChange: 0 for every recent debate, so the "0" showed on every debate.

Changes:

  • New helper frontend/src/utils/debateType.ts (formatDebateType): "User vs Bot", "User vs User", and for any other type it replaces every underscore.
  • frontend/src/Pages/Profile.tsx: uses the helper for the Type field and the summary, and only shows the Elo sentence when the change is non-zero. Removed the capitalize class from the Type field so "vs" stays lowercase.
  • frontend/src/components/SavedTranscripts.tsx: uses the same helper.

Tests:

  • ProfileDebateDetails.test.tsx (new): opens the dialog and checks the type label, that there's no trailing "0" when the change is 0, and that the Elo sentence still shows for a non-zero change.
  • SavedTranscripts.test.tsx: the dialog test now checks the "User vs Bot" label.
  • debateType.test.ts (new): unit tests for the helper.
  • The Profile and Saved Transcripts checks fail on current main and pass with this change.

Checks: npm run test (37 files, 207 tests pass), tsc -b passes, no new lint errors (each changed file has the same 1 pre-existing error before and after).

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Improvements
    • Debate types now appear with readable labels in profile details and saved transcript views, rather than underscore-separated values.
    • Debate summaries continue to show Elo changes when the value is nonzero.

The Debate Details dialog on the Profile page built the type label with
`debateType.replace("_", " ")`, which only replaces the first underscore,
so `user_vs_bot` was shown as "User Vs_bot" (and "a user vs_bot debate"
in the summary). The Saved Transcripts viewer had the same label.

The summary also rendered `{eloChange && eloChange !== 0 && ...}`. When
eloChange is 0 this evaluates to 0, which React prints, so every summary
ended with "The result was a win.0".

Add a small formatDebateType helper ("User vs Bot", "User vs User") used
in both places, and only render the Elo sentence for a non-zero change.

Fixes AOSSIE-Org#820

Signed-off-by: Furqan <furqanfurqan6677@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The profile and saved-transcript views now use shared debate-type formatting. The profile summary omits the Elo-change sentence when the value is zero and includes it for nonzero changes.

Changes: Debate display

Layer / File(s) Summary
Debate type formatter
frontend/src/utils/debateType.ts, frontend/src/utils/__tests__/debateType.test.ts
The new formatDebateType function maps known types to display labels and replaces every underscore in other values with a space. Tests cover known and unknown types.
Profile and transcript views
frontend/src/Pages/Profile.tsx, frontend/src/Pages/__tests__/ProfileDebateDetails.test.tsx, frontend/src/components/SavedTranscripts.tsx, frontend/src/components/__tests__/SavedTranscripts.test.tsx
Both views use formatDebateType. Profile summary tests cover zero and nonzero Elo changes. View tests check that the readable label appears instead of vs_bot.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: rixitgithub, compiler041

Merge Risk: Minimal · up to 12706

This change fixes the debate type label and removes the stray "0" from debate summaries when the Elo change is zero. It only affects displayed text and is easy to revert. No merge-blocking risk is apparent.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Requirements from #820 (direct, active): (a) the Profile Type field and summary show "User vs Bot" instead of "User Vs_bot"; (b) the Saved Transcripts label gets the same fix; (c) no stray "0" appears… Confirm the exact Elo conditional in frontend/src/Pages/Profile.tsx at the reviewed head, in the Debate Summary block. It must avoid rendering a bare 0 when eloChange is 0, for example {eloChange !== undefined && eloChange !== 0 && (...)} o…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two user-visible fixes in the Debate Details dialog: the debate type label and the stray 0 when the Elo change is zero. The changeset matches this. It adds formatDebateType, uses i…
Out of Scope Changes check Passed All changed files relate to #820. The new helper frontend/src/utils/debateType.ts supplies the shared label formatting the issue requests. Profile.tsx changes the Type field and summary text, which th…
Full details: Title check

Explanation

The title names the two user-visible fixes in the Debate Details dialog: the debate type label and the stray 0 when the Elo change is zero. The changeset matches this. It adds formatDebateType, uses it in Profile and SavedTranscripts, and shows the Elo sentence only for a truthy eloChange. The title does not mention the Saved Transcripts label fix or the new helper, but it still reflects the main change.

Full details: Out of Scope Changes check

Explanation

All changed files relate to #820. The new helper frontend/src/utils/debateType.ts supplies the shared label formatting the issue requests. Profile.tsx changes the Type field and summary text, which the issue names. SavedTranscripts.tsx uses the same helper, which the issue names. The removal of the capitalize class from the Type field supports the "User vs Bot" casing required by #820. The tests (ProfileDebateDetails.test.tsx, SavedTranscripts.test.tsx, debateType.test.ts) cover the changed behaviour. No unrelated behaviour change was identified in the reviewed evidence.

Full details: Linked Issues check

Explanation

Requirements from #820 (direct, active): (a) the Profile Type field and summary show "User vs Bot" instead of "User Vs_bot"; (b) the Saved Transcripts label gets the same fix; (c) no stray "0" appears in the summary when eloChange is 0; (d) the Elo sentence shows only for a non-zero change.

Requirements (a) and (b) are supported. The helper frontend/src/utils/debateType.ts at head maps user_vs_bot to "User vs Bot", user_vs_user to "User vs User", and replaces every underscore for other values. Profile.tsx at head imports formatDebateType and uses it for the Type field and summary. SavedTranscripts.tsx uses the same helper per the PR summary.

Requirement (c) and (d) are not established. The Profile.tsx diff could not be read: the diff call failed because changed blobs were missing, and the full-file read was truncated before the Debate Details summary section. The raw summary says the sentence now renders "whenever eloChange is truthy". If the JSX is literally {eloChange && (...)}, React prints 0 for eloChange = 0, and the bug in #820 remains. The PR description says the condition checks for non-zero. The new ProfileDebateDetails.test.tsx is claimed to cover the zero case, but its content was not read.

Resolution

Confirm the exact Elo conditional in frontend/src/Pages/Profile.tsx at the reviewed head, in the Debate Summary block. It must avoid rendering a bare 0 when eloChange is 0, for example {eloChange !== undefined && eloChange !== 0 && (...)} or a ternary returning null. Confirm that ProfileDebateDetails.test.tsx asserts the absence of a trailing "0" for eloChange = 0 and passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a3ebf709-7ed5-4b0f-b70c-036fbb27d5d4
Commits

Reviewing files that changed from the base of the PR and between 95b24b5 and 1270646.

Files selected for processing: 6

  • frontend/src/Pages/Profile.tsx
  • frontend/src/Pages/__tests__/ProfileDebateDetails.test.tsx
  • frontend/src/components/SavedTranscripts.tsx
  • frontend/src/components/__tests__/SavedTranscripts.test.tsx
  • frontend/src/utils/__tests__/debateType.test.ts
  • frontend/src/utils/debateType.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@gitcordapp

gitcordapp Bot commented Nov 28, 2026

Copy link
Copy Markdown

Link your account with Gitcord

Thanks for opening this PR, @Furqan-7!

To receive Discord notifications and contributor tracking for this organization:

  1. Join Discord: https://discord.gg/hjUhu33uAn
  2. In Discord, run /link Furqan-7
  3. Paste the verification code into your GitHub bio (or a public gist)
  4. Click Verify in Discord (or run /verify-link Furqan-7)

Once linked, Gitcord can notify you about reviews, merges, and more.

— Posted by Gitcord

This branch has not been deployed

No deployments
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.

[BUG]: Debate Details dialog shows debate type as "User Vs_bot" and a stray "0" at the end of the summary

1 participant