fix: bug in speakers count column in activity list#815
fix: bug in speakers count column in activity list#815priscila-moneo wants to merge 1 commit intomasterfrom
Conversation
📝 WalkthroughWalkthroughThe 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/utils/summitUtils.js (1)
52-59: Normalizespeakers_countto 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
📒 Files selected for processing (4)
src/actions/__tests__/event-actions.test.jssrc/actions/event-actions.jssrc/utils/__tests__/summitUtils.test.jssrc/utils/summitUtils.js
| 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", |
There was a problem hiding this comment.
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.
ref: https://app.clickup.com/t/86b8rpk39
event-actions.js(speakers_count[]...).event-actions.js, which is essential for correct speaker-count rendering.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
New Features
Tests