How can I distribute tasks to assignees with varying capacities [closed] - google-apps-script

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 months ago.
Improve this question
I have list of tasks and I want to automatically assign them between a list of staff members.
Each staff member has a different capacity for how many tasks they can do and I want the automatic allocation of tasks to take into account each staff member's max capacity.
I also want the allocation to take into account the order in which staff members are listed to facilitate task allocation on a first-come-first-served basis.
So far I've been able to evenly distribute the tasks, and where tasks cannot be evenly distributed, have prioritised staff members by order, however, I've not been able to take max capacity into account.
Here is a link to my Google Sheet:
https://docs.google.com/spreadsheets/d/1pr87yOdt0MS7rJ09NKqDMjwNi_UGi5reqqLGQjR8TuY/edit?usp=sharing
Note: the cells containing formulas have been highlighted in Cyan for easy reference.
Do you know how to solve this problem?

You can try with this: I first created a kind of "rounds" finding in each number of tasks assigned who would be able to work resulting in a table like this:
Then I wrapped it in a query selecting Col2 (only the names), where they weren't empty, and limiting the amount to the count of tasks in E2:E:
Let me know if this works for you, of this is what you meant. Here you have the formula in F2:
=QUERY(LAMBDA(name,num,qt,MAKEARRAY(qt*MAX(num),2,LAMBDA(r,c,LAMBDA(round,ind,IF(c=1,round,IF(INDEX(num,ind,1)>=round,INDEX(name,ind),"")))(ROUNDUP(r/qt,0),MOD(r-1,qt)+1))))(FILTER(Availability!A2:A,Availability!A2:A<>""),FILTER(Availability!C2:C, Availability!A2:A<>""),COUNTA(FILTER(Availability!A2:A,Availability!A2:A<>""))),"Select Col2 where Col2 <>'' limit "&COUNTA(E2:E))

Related

Can SQL replicate Excel's auto-updating cells based on other cells? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a database of some devices, each with details on their status for things like maintenance schedule, last calibration date, age, warranty status, etc. One of the points of this database is to give us a yes/no answer whether it should be in service or not, based on all these other data points being a certain way. If this was Excel, I could make a cell and use IF statements to get this automatically, and any time one field like warranty fell out of date, the "in service" field would also switch to "No".
Is it possible for a MySQL database to do this automatically?
Yes. If all the values you need are in one row, you can use a generated column.
If values needed for the calculation come from other rows or tables, then you can use a view.
Other than that, it is hard to provide more specifics because you question lacks helpful details.

Best Practice for Budgeting MySQL Database Design [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm trying to find the best solution for my needs. I have a budgeting application that each user will have their own budget which will include potentially hundreds or thousands of budget entries. Initially I thought I would have a table for the users and basic info, and then each user would have their own sql table with all of their budget items held within. However, if the user list grows to hundreds or thousands then I would have a large amount of tables since each user would have their own. I also considered a single table to hold everyone's budget entries but I'm not sure that's the correct solution either.
Any advice? Thank you in advance
I think a single table that holds all the budget entries, with a primary key that's referenced by a foreign key in the "users" table, is a good way to go. You can always use something like select * from users u join budgets b on u.userID = b.userID where userID = xxx to get the budget items for a particular user.

Football Database Scheme [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm currently trying to build a football database in MySQL. It should store the fixtures from different leagues, plus their results, odds and some other information.
Is the scheme I just created correct or are there any mistakes in it? If so, what can I improve? I'm also not really sure about the link between tblMatch and tblTeams.
Afterwards I want to be able to make a Query where I can select a fixture including the points the home and away team got before the match, plus the average amount of goals of the teams. Like the new fields: 'homeTeamPoints', 'awayTeamPoints' ect.
So my question is: Where should I put these fields? In an extra table or should I put those in the table: 'tblMatch' and store the precalculated values there?
I hope you get what I tried to explain.
Best Regards
-bababow
A few notes:
You will want to replace "homeTeam" and "awayTeam" with "homeTeamID" and "awayTeamId" which will be foreign keys to the tblTeams table. This will enforce that the teams in the match both actually exist.
Remove the matchID and competitionID from the teams. I'm assuming teams can participate in many matches and competitions and therefore this structure will not support that.
What do you want to know about competitions? Is this a tournament? You may want to have a "bracket" and/or "tournament winner" column in there to store the results of the overall tournament.
Those are my main thoughts, other than that it looks OK.
In my perspective if the values of both the fields needs update regularly and table tblMatch data size is large then you should take it into separate table. if both the fields are updates whenever whole record is change then it could be in tblMatch table.

Open Graph - Muliple Objects on same action [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am trying to figure out a way to implement og action for an e-commerce site. Action would be like "Buy a Product" but usually people buys multiple products at a time by Adding different items to Cart. I do not want to show as "Jack bought xx, Jack bought yy,etc.." instead I would like to have an action like "complete purchase" where purchase is an object that might have multiple items. Any idea appreciated.
I do not want to show as "Jack bought xx, Jack bought yy,etc.."
Why not? You could suppress the feed story that publishing an action creates for all but the first one, and multiple actions of the same type should “fold” nicely when they are displayed on the user’s timeline, like “John Doe bought Foobar and 16 other Products at …”
Your other option would be to make purchase your object that the action is taken upon (as you already said), and then have custom properties for this object, which “link” it to other items of the type product. But AFAIK the number of these custom properties can not be dynamic, so you’d have to agree on a maximum number of products a purchase can contain before, which is probably not so nice. But you could set up purchase as an object that links to a page of your own that displays all products bought, and have the purchase object only contain the first (cheapest/most expensive/…) X of those as custom properties.

Mysql table design : table roles [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a table called enterprise in my database. If the enterprise expresses its demand to my company, the enterprise will become our prospection. And after, if the enterprise accept my company's proposal, we will sign the contract, and enterprise becomes out client.
Now, I have created 3 tables which are enterprise, prospection, client.
So, how should I design the database?
One approach would be to have a table Companies, and the three tables you already have. All three tables have field CompanyId that has a foreign key constratint linkining it to the companies table. This design has the advantage that you have to keep the company information in one place and there is no duplication.
Another way would be to have a field in the companies table, that marks them as an enterprise, prospect, or client.
Which design you should choose largely depends on information for the different classes. If you thinking along inheritance (i.e. a client is a prospect is a enterprise) than the company table suffices. However, if ther is a large amount of information and the information is different for each of the three classes than the first approach would be better.
You should, however, always try to keep the information in one place, i.e. in one field/table (= fully normalized). In some cases you can deviate from this principle for performance reasons, but keep in mind that this also means a higher maintenance overhead - you have to update n tables when a value changes.