Skip to content

fix: bug in speakers count column in activity list#815

Open
priscila-moneo wants to merge 1 commit intomasterfrom
fix/bug-activity-list-speakers-count
Open

fix: bug in speakers count column in activity list#815
priscila-moneo wants to merge 1 commit intomasterfrom
fix/bug-activity-list-speakers-count

Conversation

@priscila-moneo
Copy link

@priscila-moneo priscila-moneo commented Mar 6, 2026

ref: https://app.clickup.com/t/86b8rpk39

image
  • Range filter format is fixed in event-actions.js (speakers_count[]...).
  • type.use_speakers was added to getEvents fields in event-actions.js, which is essential for correct speaker-count rendering.
  • formatEventData now safely handles missing type via e.type?.use_speakers in summitUtils.js, avoiding runtime failures.

Residual risk:
speakers_count remains mixed-type (number vs string), which is legacy behavior. It works now, but normalization could improve long-term consistency.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected speaker-count range filter syntax.
    • Improved handling when event type information is missing to avoid runtime errors.
  • New Features

    • Include event speaker-support flag when retrieving event data.
  • Tests

    • Added tests covering event filtering logic and formatting of speaker counts under various scenarios.

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 462057b0-328b-4572-9928-a440f650ca36

📥 Commits

Reviewing files that changed from the base of the PR and between e28b8e8 and f46424d.

📒 Files selected for processing (4)
  • src/actions/__tests__/event-actions.test.js
  • src/actions/event-actions.js
  • src/utils/__tests__/summitUtils.test.js
  • src/utils/summitUtils.js
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/actions/event-actions.js
  • src/actions/tests/event-actions.test.js
  • src/utils/tests/summitUtils.test.js
  • src/utils/summitUtils.js

📝 Walkthrough

Walkthrough

Adds tests for event actions and summit utilities, fixes speakers_count filter range syntax in parseFilters, includes type.use_speakers in getEvents API fields, and makes formatEventData resilient to missing event.type via optional chaining.

Changes

Cohort / File(s) Summary
Event Actions & Tests
src/actions/event-actions.js, src/actions/__tests__/event-actions.test.js
Fixed speakers_count between-range construction (removed extra bracket, apply range only when value is an array of length 2), added request field type.use_speakers in getEvents, and added tests that mock API calls and assert constructed filter[] and requested fields.
Summit Utils & Tests
src/utils/summitUtils.js, src/utils/__tests__/summitUtils.test.js
Replaced direct e.type.use_speakers access with e.type?.use_speakers in formatEventData to avoid errors when type is missing; added tests validating speakers_count for present, empty, and missing type scenarios.

Sequence Diagram(s)

(Skipped — changes are tests and small parsing/utility fixes without multi-component new control flow.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • martinquiroga-exo
  • smarcet

Poem

🐰 I hopped through filters, fixed a brace,
Optional chains kept me steady in place,
Tests hop in rows to count each friend,
Tokens mocked, requests caught end to end,
A merry rabbit cheers this tidy case!

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately and concisely summarizes the main fix: addressing a bug in the speakers count column display within the activity list.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/bug-activity-list-speakers-count
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link

@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

🧹 Nitpick comments (1)
src/utils/summitUtils.js (1)

52-59: Normalize speakers_count to a single data type.

This branch still returns a number, "0", and "N/A". Any generic sorter/filter on the column will keep getting mixed semantics until the raw field is normalized and the display label is derived separately.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/summitUtils.js` around lines 52 - 59, The code assigns mixed types
to speakers_count (number, string "0", and "N/A"); change it so speakers_count
is a single data type (prefer a numeric or nullable numeric) by setting
speakers_count = e.speakers?.length ?? 0 when e.type?.use_speakers is true (so
it is always a number) and speakers_count = null (or -1 if you prefer sentinel)
when use_speakers is false; keep any human-readable labels like "N/A" in the
presentation layer, not here. Ensure you update references to speakers_count
accordingly (look for speakers_count, e.type?.use_speakers, and e.speakers in
this module).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/actions/event-actions.js`:
- Around line 564-565: The fields list in event-actions.js omits
type.allows_location, type.allows_attendee_vote, and
type.allows_publishing_dates which formatEventData in src/utils/summitUtils.js
depends on; update the fields string (the CSV after "fields:") to include these
three type.* flags so summitUtils.formatEventData sees the real event-type
capabilities and correctly computes event_type_capacity and duration.

---

Nitpick comments:
In `@src/utils/summitUtils.js`:
- Around line 52-59: The code assigns mixed types to speakers_count (number,
string "0", and "N/A"); change it so speakers_count is a single data type
(prefer a numeric or nullable numeric) by setting speakers_count =
e.speakers?.length ?? 0 when e.type?.use_speakers is true (so it is always a
number) and speakers_count = null (or -1 if you prefer sentinel) when
use_speakers is false; keep any human-readable labels like "N/A" in the
presentation layer, not here. Ensure you update references to speakers_count
accordingly (look for speakers_count, e.type?.use_speakers, and e.speakers in
this module).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18d968cd-32e7-4426-85ef-0567c8e2d260

📥 Commits

Reviewing files that changed from the base of the PR and between 827fd4a and e28b8e8.

📒 Files selected for processing (4)
  • src/actions/__tests__/event-actions.test.js
  • src/actions/event-actions.js
  • src/utils/__tests__/summitUtils.test.js
  • src/utils/summitUtils.js

Comment on lines 564 to +565
fields:
"id,created,last_edited,title,start_date,end_date,summit_id,duration,class_name,is_published,level,published_date,meeting_url,status,progress,selection_status,streaming_url,streaming_type,etherpad_link,location.id,location.name,speakers.id,speakers.first_name,speakers.last_name,speakers.company,track.name,track.id,created_by.first_name,created_by.last_name,created_by.email,created_by.company,selection_plan.name,selection_plan.id,media_uploads.id,media_uploads.presentation_id,media_uploads.created,media_uploads.class_name,media_uploads.display_on_site,media_uploads.media_upload_type.name,media_uploads.media_upload_type.id,type.id,type.name,sponsors.id,sponsors.name,allow_feedback,to_record,review_status",
"id,created,last_edited,title,start_date,end_date,summit_id,duration,class_name,is_published,level,published_date,meeting_url,status,progress,selection_status,streaming_url,streaming_type,etherpad_link,location.id,location.name,speakers.id,speakers.first_name,speakers.last_name,speakers.company,track.name,track.id,created_by.first_name,created_by.last_name,created_by.email,created_by.company,selection_plan.name,selection_plan.id,media_uploads.id,media_uploads.presentation_id,media_uploads.created,media_uploads.class_name,media_uploads.display_on_site,media_uploads.media_upload_type.name,media_uploads.media_upload_type.id,type.id,type.name,type.use_speakers,sponsors.id,sponsors.name,allow_feedback,to_record,review_status",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Request the other type.* flags that formatEventData already depends on.

src/utils/summitUtils.js also reads type.allows_location, type.allows_attendee_vote, and type.allows_publishing_dates (Lines 44-48 and 92-94 there). Since Line 565 still omits them, the list formatter keeps treating those capabilities as falsy on real event-list payloads, so event_type_capacity/duration remain wrong even after this fix.

Suggested patch
-        "id,created,last_edited,title,start_date,end_date,summit_id,duration,class_name,is_published,level,published_date,meeting_url,status,progress,selection_status,streaming_url,streaming_type,etherpad_link,location.id,location.name,speakers.id,speakers.first_name,speakers.last_name,speakers.company,track.name,track.id,created_by.first_name,created_by.last_name,created_by.email,created_by.company,selection_plan.name,selection_plan.id,media_uploads.id,media_uploads.presentation_id,media_uploads.created,media_uploads.class_name,media_uploads.display_on_site,media_uploads.media_upload_type.name,media_uploads.media_upload_type.id,type.id,type.name,type.use_speakers,sponsors.id,sponsors.name,allow_feedback,to_record,review_status",
+        "id,created,last_edited,title,start_date,end_date,summit_id,duration,class_name,is_published,level,published_date,meeting_url,status,progress,selection_status,streaming_url,streaming_type,etherpad_link,location.id,location.name,speakers.id,speakers.first_name,speakers.last_name,speakers.company,track.name,track.id,created_by.first_name,created_by.last_name,created_by.email,created_by.company,selection_plan.name,selection_plan.id,media_uploads.id,media_uploads.presentation_id,media_uploads.created,media_uploads.class_name,media_uploads.display_on_site,media_uploads.media_upload_type.name,media_uploads.media_upload_type.id,type.id,type.name,type.use_speakers,type.allows_location,type.allows_attendee_vote,type.allows_publishing_dates,sponsors.id,sponsors.name,allow_feedback,to_record,review_status",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/actions/event-actions.js` around lines 564 - 565, The fields list in
event-actions.js omits type.allows_location, type.allows_attendee_vote, and
type.allows_publishing_dates which formatEventData in src/utils/summitUtils.js
depends on; update the fields string (the CSV after "fields:") to include these
three type.* flags so summitUtils.formatEventData sees the real event-type
capabilities and correctly computes event_type_capacity and duration.

Copy link

@martinquiroga-exo martinquiroga-exo left a comment

Choose a reason for hiding this comment

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

@priscila-moneo please see comments.

sponsors: []
};

expect(() => formatEventData(event, summit)).not.toThrow();

Choose a reason for hiding this comment

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

Double function call, it can be done cleaner:

let result;
expect(() => {
  result = formatEventData(event, summit);
}).not.toThrow();

// between
filter.push(
`speakers_count[]]${filters.speakers_count_filter[0]}&&${filters.speakers_count_filter[1]}`
`speakers_count[]${filters.speakers_count_filter[0]}&&${filters.speakers_count_filter[1]}`

Choose a reason for hiding this comment

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

I see no validation for the array having 2 elements.

@priscila-moneo priscila-moneo force-pushed the fix/bug-activity-list-speakers-count branch from e28b8e8 to f46424d Compare March 16, 2026 20:07
Copy link

@martinquiroga-exo martinquiroga-exo left a comment

Choose a reason for hiding this comment

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

LGTM

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