Skip to content

Add include_bots_in_aggregates checkbox to question creation#4211

Merged
lsabor merged 5 commits intomainfrom
claude/issue-4210-20260201-0420
Feb 5, 2026
Merged

Add include_bots_in_aggregates checkbox to question creation#4211
lsabor merged 5 commits intomainfrom
claude/issue-4210-20260201-0420

Conversation

@lsabor
Copy link
Contributor

@lsabor lsabor commented Feb 1, 2026

Adds a checkbox for include_bots_in_aggregates to the Advanced Options section in question creation.

Closes #4210

Changes

  • Added checkbox to Advanced Options section in question form
  • Field is properly integrated with React Hook Form
  • Uses existing backend field (questions/models.py)
  • Default value is true for new questions
  • Checkbox appears after project picker in Advanced Options

Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added an Advanced Options checkbox to include bots in aggregate calculations; value is persisted in drafts and submissions (defaults to off).
  • Localization

    • Added label and explanatory text for the new option in English, Spanish, Portuguese, Czech, Simplified Chinese, and Traditional Chinese.

… options

- Added checkbox to Advanced Options section in question form
- Field is properly integrated with React Hook Form
- Uses existing backend field (questions/models.py)
- Default value is false for new questions
- Checkbox is shown after project picker in Advanced Options

Co-authored-by: Luke Sabor <lsabor@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 1, 2026

📝 Walkthrough

Walkthrough

Added a new boolean field include_bots_in_aggregates to the question form flow: public schema, ExtendedQuestionDraft type, form defaultValues, draft↔form mapping, registration in React Hook Form, submission payload, and an Advanced Options Checkbox UI. Also added localization keys in multiple message files. Default is false.

Changes

Cohort / File(s) Summary
Question form
front_end/src/app/(main)/questions/components/question_form.tsx
Introduce include_bots_in_aggregates?: boolean in schema/types, set defaultValues and draft→form mapping to ... ?? false, register and persist field in form lifecycle, add Advanced Options Checkbox bound to form state and update via setValue (with shouldDirty/shouldTouch/shouldValidate).
Localization
front_end/messages/en.json, front_end/messages/es.json, front_end/messages/pt.json, front_end/messages/cs.json, front_end/messages/zh.json, front_end/messages/zh-TW.json
Add includeBotsInAggregatesLabel and includeBotsInAggregatesExplanation keys in each locale. No logic changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I twitch my nose at a tiny new switch,
"Include the bots?" — a checkbox, not a glitch.
Schemas and drafts all hop into place,
Forms set to false, then saved with grace. 🥕✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a checkbox for include_bots_in_aggregates to the question creation form.
Linked Issues check ✅ Passed The PR successfully implements the requirement from issue #4210 to add an include_bots_in_aggregates checkbox to Advanced Options in question creation [#4210].
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the checkbox feature and its localization; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/issue-4210-20260201-0420

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@lsabor lsabor marked this pull request as ready for review February 1, 2026 15:44
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@front_end/src/app/`(main)/questions/components/question_form.tsx:
- Line 225: The schema field include_bots_in_aggregates currently uses
.default(true) but the PR requires the checkbox default to be false; change the
schema to .default(false) and propagate that change to the places that set
initial state: update the defaultValues object that seeds the form and adjust
the draft conversion logic (the function that converts a draft to a question /
draft conversion path) to ensure include_bots_in_aggregates is set to false for
new questions rather than true.
- Around line 471-472: The fallback for include_bots_in_aggregates is incorrect:
change the default used when post?.question?.include_bots_in_aggregates is
null/undefined from true to false so new questions default to false; update the
expression around include_bots_in_aggregates in QuestionForm (the
post?.question?.include_bots_in_aggregates ?? true usage) to use false as the
nullish fallback.
- Line 529: ExtendedQuestionDraft is missing the include_bots_in_aggregates
property so draft.include_bots_in_aggregates is untyped and the mapping uses the
wrong fallback; add a boolean include_bots_in_aggregates?: boolean to the
ExtendedQuestionDraft interface and change the mapping that sets
include_bots_in_aggregates from draft.include_bots_in_aggregates ?? true to
draft.include_bots_in_aggregates ?? false so the default aligns with PR
requirements.
🧹 Nitpick comments (2)
front_end/src/app/(main)/questions/components/question_form.tsx (2)

475-477: Unnecessary field registration.

This useEffect is redundant. The field is already initialized in defaultValues and defined in the schema, so react-hook-form automatically tracks it. Manual registration is only needed for uncontrolled inputs without default values.

♻️ Proposed fix: Remove unnecessary useEffect
-  useEffect(() => {
-    form.register("include_bots_in_aggregates");
-  }, [form]);

957-975: Duplicate label and incorrect fallback value.

  1. The InputContainer already renders "Include Bots in Aggregates" as a label. The Checkbox component's label prop creates a second label, causing visual redundancy.
  2. The ?? true fallback should be ?? false per PR requirements.
♻️ Proposed fix
          <InputContainer
            labelText="Include Bots in Aggregates"
            explanation="When enabled, bot forecasts will be included in aggregate calculations for this question."
            isNativeFormControl={false}
            className="mb-6"
          >
            <Checkbox
-             label="Include Bots in Aggregates"
-             checked={form.watch("include_bots_in_aggregates") ?? true}
+             checked={form.watch("include_bots_in_aggregates") ?? false}
              onChange={(checked) => {
                form.setValue("include_bots_in_aggregates", checked, {
                  shouldDirty: true,
                  shouldTouch: true,
                  shouldValidate: true,
                });
              }}
            />
          </InputContainer>
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6968bbd and 75823bb.

📒 Files selected for processing (1)
  • front_end/src/app/(main)/questions/components/question_form.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
front_end/src/app/(main)/questions/components/question_form.tsx (1)
front_end/src/components/ui/input_container.tsx (1)
  • InputContainer (13-67)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build Docker Image / Build Docker Image
  • GitHub Check: integration-tests
🔇 Additional comments (1)
front_end/src/app/(main)/questions/components/question_form.tsx (1)

22-22: LGTM!

Import is correctly added for the new Checkbox component.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

🧹 Preview Environment Cleaned Up

The preview environment for this PR has been destroyed.

Resource Status
🌐 Preview App ✅ Deleted
🗄️ PostgreSQL Branch ✅ Deleted
⚡ Redis Database ✅ Deleted
🔧 GitHub Deployments ✅ Removed
📦 Docker Image ⚠️ Retained (auto-cleanup via GHCR policies)

Cleanup triggered by PR close at 2026-02-05T16:52:09Z

Copy link
Contributor

@ncarazon ncarazon left a comment

Choose a reason for hiding this comment

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

fix interface typing suggested by coderabbit, otherwise lgtm

Copy link
Contributor

@CodexVeritas CodexVeritas left a comment

Choose a reason for hiding this comment

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

This looks good to me. Just handle the coderabbit comment. The "include_bots_in_aggregates" should still default to false, at least until this PR resolves.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@front_end/src/app/`(main)/questions/components/question_form.tsx:
- Around line 958-975: The InputContainer and Checkbox currently both render the
same label causing duplicate text; remove the label from one side—prefer keeping
the label on Checkbox and use InputContainer only for layout/explanation.
Concretely, in the JSX around InputContainer and Checkbox (components
InputContainer and Checkbox) remove or clear the InputContainer prop labelText
and retain Checkbox's label prop (keep explanation, isNativeFormControl,
className on InputContainer), ensuring the form.watch/setValue logic and
Checkbox checked/onChange remain unchanged.

@lsabor lsabor merged commit b4bd066 into main Feb 5, 2026
14 of 15 checks passed
@lsabor lsabor deleted the claude/issue-4210-20260201-0420 branch February 5, 2026 16:52
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.

add include_bots_in_aggregates checkbox to advanced options in question creation

3 participants