Automate team selection based on users's 'weight'; ie: a value determined by a simple algo

I have an application that has 300 users. Well, not yet. But I will.

When these 300 users complete their onboarding, they are assigned a weight in the form of a numerical value.

This is determined by some values they select during onboarding.

So, weight = number

When there are 300 users, I want to then sort them into a team based on an average weight of 5, with a max of 20 users in each team.

Team = 20 users, average weight of 5

I’m struggling to come up with a method that automates this. I’ve been able to think of ways to do this when a user loads a certain page, but I want this to all happen behind the scenes, whether a user is signed in or not.

I’m aware that there are workflows that use ‘do when true’, but I’m not sure if this is a viable method, either.

Can anyone help breakdown the logic of this and help me understand the best way to implement a system that automatically sorts users into a team within certain bounds?

Thanks so much :)))))

You can run it as a recurring workflow everyday that reassigns the team or recalculates their weight

Or you every time a user logs in it recalculates all users.

I’m not sure about this but I think you may find :groupby useful for things such as weight 5-10 = team1
Weight 10 - 20 = team 2 etc when assigning the team

This topic was automatically closed after 70 days. New replies are no longer allowed.