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 filter syntax for speaker count range filtering
    • Improved error handling when event type information is unavailable
  • New Features

    • Added speaker count field retrieval for events with speaker support enabled
  • Tests

    • Added comprehensive test coverage for event filtering and data formatting with speaker counts

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

The changes introduce tests for event and summit utilities, fix a filter syntax error in speaker count range construction, add optional chaining for safer type property access, and expand API field requests to include type.use_speakers for event listing.

Changes

Cohort / File(s) Summary
Event Actions Implementation & Tests
src/actions/event-actions.js, src/actions/__tests__/event-actions.test.js
Fixed syntax error in parseFilters for speakers_count range filters, expanded getEvents to request type.use_speakers field, and added comprehensive test suite validating filter construction and API parameters.
Summit Utils Implementation & Tests
src/utils/summitUtils.js, src/utils/__tests__/summitUtils.test.js
Applied optional chaining to safely access e.type?.use_speakers in formatEventData, preventing runtime errors when type is undefined, with tests verifying speakers_count formatting across populated, empty, and missing type scenarios.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 A filter fixed with bracket care,
Optional chains float through the air,
Tests now guard the speakers' count,
Safe from undefined's dark mount,
Type.use_speakers shines so bright!

🚥 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 summarizes the main fix: addressing a bug in the speakers count column display in 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

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.

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.

1 participant