Hey everyone, I have a question, and I don't know if it's even possible to achieve. I have clients and workers, each worker has a "main client" who is the most important client for this worker. Also each worker can have other clients assignet to him and one client can be assigned to many workers. The schemma looks more or less like this: A - assiged to each other M - main client Wx - Worker Cx - Client
| C1 | C2 | C3 | C4 | C5 |
w1 | M | | A | A | A |
w2 | A | M | | A | |
w3 | | | A | A | M |
w4 | A | A | | A | M |
w5 | A | | M | A | |
w6 | | A | M | | |
w7 | A | M | | A | |
Now, I want assign a survey for workers who would answer some questions about clients. But there are some rules - Each worker has to evaluate his "main client" - Each worker has to evaluate one client assigned to him excluding "main client" - Clinets has to be evaluated somehow proportional And with that third rule I have a problem. Without it I would create an array with main client and the other would be a result of the following code:
$clientsToEvaluate = [];
$clientsToEvaluate[] = $mainClient; //finding is easy
/*gather other clients' ids and shuffle it*/
shuffle($otherClients);
$clientsToEvaluate[] = array_slice($otherClients,0,1);
But I don't know how to implement the third rule (to make it proportional). Do you happen to know how to solve it. I'd be very grateful foe each suggestion.