Randomly Match Users Together Weekly

Hi.

I’m creating an app that randomly matches one user to another once every week.

I am struggling to do this in bubble.

I would like to do a weekly recurring event in the API Workflow. I would have one big list of users, pick out two, see if they have already been matched. If not, match them up and take them out of the pool.

Would really appreciate any implementation advice here (or suggestion of another algorithm)

Brendan

Every User in the database is:

(Do a) Search for… Users

A randomly-sorted list of every User in the database is:

(Do a) Search for… Users (sorted by Random)

This will return a list of Users that isn’t as random as you would like (because of how random seeds work).

So, a way-more-randomized single User selected from that list is:

(Do a) Search for Users (sorted by Random):random item

This is a quite random User that you can hook up (sorry, “pair”) with another User.

Want to ensure that random user is not Current User? Expression is:

(Do a) Search for Users (sorted by Random):minus item Current User:random item

This is a truly random User that is not the User represented by Current User.

(Personally, I’d be fine with hooking up Current User with themselves as, well, that’s funny, right? But the last example does what you want.)

2 Likes

NOW, if you want to ensure that Users are not paired with other Users they have been “paired” with before: Every time a User… err… is paired with… ummm… another User, you push the submissive User on to a list of Users that the dominant User has subjugated.

And then, in the same way we :minus item’ed a single User, we “:remove list” the list of Users that Current User has “been with”.

And this will present us with a new User to subjugate, that has never been dominated by Current User heretofore.

P.S., this sounds like an awesome app.

1 Like

Hey @keith thanks so much for this. This all makes sense. I had come up with a similarish model.

I’m just struggling to implement using bubble.

I have every user on the platform set with a recurring event (that happens weekly).

Then when I go to to API workflows and I tried to implement it, I’m stuck. Don’t quite know how to implement everything you’ve said from here.

1 Like

Well, you don’t have to update the list weekly. We already know that Mike has been paired with Laura as Laura is already in Mike’s “paired with” list, see?

Anytime we need to pick a new partner for Mike, we automagically kick Laura out of the list of available “pairing” partners.

1 Like

Okay so I get this. But I don’t get how to even create this list in bubble in the first place, especially in API workflows section

This is what I have.

  • I set every user that opts in with this recurring event.
  • Once a week, I perform the recurring event
    • The event searches all users. It filters out those who didn’t opt in to meetup this week & filters out people who have already met with the current user before.
    • It then adds user B to User A’s list of people to meet with
    • I then know that the last person in User A’s list is the person they are meeting this week

My question is, now, how do add User A to User B’s list and make sure the recurring event does not occur on User B and create a new meet up for them?

Is the result of the first action in the expression below = User A or User B?

Ah!

I think I’ve got it.

Doesn’t matter what the result is for the second action. I just looked at the last item of the meetup list of the current workflow user to get User B!

Thank you @keith for your help