Commit 38a7fcf
authored
fix: filter segment members to only show those with host entries (calcom#26816)
## What does this PR do?
Fixes a bug where the UI shows team members who match segment criteria even when they don't have host entries in the database. When `assignAllTeamMembers` is `true` and segment filtering is enabled, members would appear in the Assignment tab but wouldn't actually be assigned during booking because they lack host entries.
**The Problem:**
- The filtering logic in `EditWeightsForAllTeamMembers` short-circuited when `assignAllTeamMembers` was true, showing all segment-matching members regardless of whether they had host entries
- The `handleSave` function only updates hosts that already exist in the `value` array, filtering out members without host entries
- This created a misleading UI where members appeared but wouldn't be assigned
**The Fix:**
- Removed the `assignAllTeamMembers` prop from `EditWeightsForAllTeamMembers` component entirely since the filtering should always check for existing host entries
- Updated the filter in `EditWeightsForAllTeamMembers.tsx` to always check for existing host entries in the `value` array
- Added `filterMemberIds` prop to `Segment` component to filter matching team members to only show those who are hosts of the event-type
- `AddMembersWithSwitch` now passes the list of non-fixed host user IDs to the Segment component via `filterMemberIds`
## Mandatory Tasks (DO NOT REMOVE)
- [x] I have self-reviewed the code (A decent size PR without self-review might be rejected).
- [x] I have updated the developer docs in /docs if this PR makes changes that would require a [documentation change](https://cal.com/docs). N/A - no documentation changes needed.
- [ ] I confirm automated tests are in place that prove my fix is effective or that my feature works.
## How should this be tested?
1. Create a team event type with round-robin scheduling
2. Enable "Assign all team members" toggle
3. Enable segment filtering with criteria that matches some team members
4. Verify that only members who have host entries (are actually assigned to the event type) appear in the "Edit team member weights" sheet
5. Members matching segment criteria but without host entries should NOT be displayed
## Checklist
- [x] My code follows the style guidelines of this project
- [x] I have checked if my changes generate no new warnings
---
### Human Review Checklist
- [ ] Verify the filtering logic correctly shows only members with host entries in both `EditWeightsForAllTeamMembers` and `Segment` components
- [ ] Confirm this aligns with the actual booking behavior (members without host entries won't be assigned)
- [ ] Check that `filterMemberIds` prop is correctly passed through `AddMembersWithSwitch` → `MembersSegmentWithToggle` → `Segment` → `MatchingTeamMembers`
- [ ] Verify the filter `value.filter((host) => !host.isFixed).map((host) => host.userId)` correctly extracts non-fixed host IDs
---
Link to Devin run: https://app.devin.ai/sessions/3333b41226d0452e98ef7ac358511f5b
Requested by: @hariombalhara1 parent e620264 commit 38a7fcf
4 files changed
Lines changed: 77 additions & 84 deletions
File tree
- apps/web/modules/event-types/components
- tabs/assignment
- packages/features
Lines changed: 12 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | 1 | | |
7 | | - | |
8 | 2 | | |
9 | | - | |
10 | 3 | | |
11 | 4 | | |
12 | 5 | | |
13 | 6 | | |
14 | 7 | | |
15 | 8 | | |
| 9 | + | |
16 | 10 | | |
17 | 11 | | |
18 | | - | |
19 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
20 | 17 | | |
21 | 18 | | |
22 | | - | |
23 | 19 | | |
| 20 | + | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| |||
130 | 127 | | |
131 | 128 | | |
132 | 129 | | |
| 130 | + | |
133 | 131 | | |
134 | 132 | | |
135 | 133 | | |
136 | 134 | | |
137 | 135 | | |
138 | 136 | | |
139 | 137 | | |
| 138 | + | |
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
| |||
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
| 164 | + | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
| |||
Lines changed: 6 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | | - | |
14 | | - | |
| 11 | + | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
| |||
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 24 | | |
| 25 | + | |
| 26 | + | |
32 | 27 | | |
33 | 28 | | |
34 | 29 | | |
| |||
102 | 97 | | |
103 | 98 | | |
104 | 99 | | |
105 | | - | |
106 | 100 | | |
107 | 101 | | |
108 | 102 | | |
| |||
112 | 106 | | |
113 | 107 | | |
114 | 108 | | |
115 | | - | |
116 | 109 | | |
117 | 110 | | |
118 | 111 | | |
| |||
240 | 233 | | |
241 | 234 | | |
242 | 235 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 236 | + | |
248 | 237 | | |
249 | | - | |
| 238 | + | |
250 | 239 | | |
251 | 240 | | |
252 | 241 | | |
| |||
Lines changed: 39 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 1 | | |
21 | | - | |
22 | | - | |
23 | 2 | | |
| 3 | + | |
24 | 4 | | |
25 | 5 | | |
26 | 6 | | |
| 7 | + | |
27 | 8 | | |
| 9 | + | |
28 | 10 | | |
29 | 11 | | |
30 | 12 | | |
31 | 13 | | |
32 | 14 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 15 | + | |
36 | 16 | | |
37 | 17 | | |
38 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
| |||
506 | 503 | | |
507 | 504 | | |
508 | 505 | | |
509 | | - | |
510 | 506 | | |
511 | 507 | | |
512 | 508 | | |
| |||
666 | 662 | | |
667 | 663 | | |
668 | 664 | | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
673 | 669 | | |
674 | 670 | | |
675 | 671 | | |
| |||
724 | 720 | | |
725 | 721 | | |
726 | 722 | | |
727 | | - | |
| 723 | + | |
728 | 724 | | |
729 | 725 | | |
730 | 726 | | |
| |||
745 | 741 | | |
746 | 742 | | |
747 | 743 | | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
759 | 755 | | |
760 | 756 | | |
761 | 757 | | |
| |||
887 | 883 | | |
888 | 884 | | |
889 | 885 | | |
890 | | - | |
| 886 | + | |
891 | 887 | | |
892 | 888 | | |
893 | | - | |
894 | | - | |
| 889 | + | |
895 | 890 | | |
896 | | - | |
897 | 891 | | |
898 | 892 | | |
899 | 893 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 3 | | |
9 | 4 | | |
10 | | - | |
11 | 5 | | |
| 6 | + | |
12 | 7 | | |
13 | 8 | | |
14 | 9 | | |
15 | 10 | | |
16 | 11 | | |
17 | | - | |
| 12 | + | |
18 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
| |||
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
112 | | - | |
113 | | - | |
| 114 | + | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
161 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
| |||
184 | 190 | | |
185 | 191 | | |
186 | 192 | | |
| 193 | + | |
187 | 194 | | |
188 | 195 | | |
189 | 196 | | |
190 | 197 | | |
191 | 198 | | |
| 199 | + | |
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
| |||
205 | 213 | | |
206 | 214 | | |
207 | 215 | | |
| 216 | + | |
208 | 217 | | |
209 | 218 | | |
210 | 219 | | |
0 commit comments