We need build an simple and customizable module with python to organize Multi Level Marketing websites.
Some MLM are Binary, some ternary, and so on...
What module need do:
We need setup on database how much people per line it will be... 2, 3, 4, 5 or more...
And system will need be able to permit I add new people down to any position...
Look at image I put on uploaded files as samples...
On ternary tree, when user on seat 3 insert one user down to his position, it will need take next seat down to 3... that will be 8, 9 or 10.
Seats will be taken from left to right and from up to down from user seat (3 for sample) to down... 8, 9, 10... 23, 24, 25, 26, 27, 28, 29, 30, 31.... (on ternary tree)
Each user will ever add new people down to his seat...
But his seat position change if tree was configured on database to 2 (binary) or 3 (ternary) or more positions. need to be customizable...
Project will never change when it start... but at start, need to be customizable.
each user will have one seat, but sometimes him can have more than 1 seat, so the table that will store this info, can't be unique to user id table.
and for last requirements, the module need have an helper that will allow me to do this questions:
-> get all users down to position N (3 for sample) until next X levels.
Eg. 2 levels on binary tree will result on seats: (6, 7, 12, 13, 14, 15) if have some users on it
-> get the user up from position N... on ternary tree, the user upper to position 12, is 4. On binary, user upper to position 7 is 3 and so on.
-> get the upper users from position N until Y levels.
ex. ternary position 10, catch 2 levels up... returns (3, 1)
ternary position 3, catch 2 levels up... returns (1...)
binary position 10, catch 3 levels up... returns (5, 2, 1)