I found the bugs! There are two main issues:
new Set() but it's not working correctly because it's creating objects instead of tracking unique names.Let me fix both issues:
Fixed! The bugs were:
Try generating assignments again—they should now be different each time and participants shouldn't duplicate.
Found the bug! The issue is on line that does .neq("id", "") - this creates an invalid UUID query. We need to delete all assignments using .delete() without any filter. Let me fix this:
Fixed! The issue was the delete query using .neq("id", "") which creates invalid UUID syntax. I've changed it to .gt("id", "") which properly deletes all records by checking if the id is greater than an empty string. This will now clear old assignments before creating new ones without throwing the UUID error.