return user_groups should be one level to the left of where it is shown in this image.
Where it currently is, your outer for-loop will only ever look at the first item, since the return will completely leave the function before it gets to the 2nd run of that outer for-loop.
If you move return user_groups one level to the left so it is outside both for-loops, then your outer loop will do all its stuff and finish first before the return statement is reached.
1
u/echols021 Aug 29 '25
return user_groupsshould be one level to the left of where it is shown in this image.Where it currently is, your outer for-loop will only ever look at the first item, since the return will completely leave the function before it gets to the 2nd run of that outer for-loop.
If you move
return user_groupsone level to the left so it is outside both for-loops, then your outer loop will do all its stuff and finish first before the return statement is reached.