Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Business rule coding help.

Status
Not open for further replies.

SpiderFlight

Programmer
Aug 22, 2001
37
US
Here is my question. We have employees which will be assigned tasks. The tasks are divided into 3 catergories (easy, medium, hard). Each catergory is assign a percent and the total cannot be greater then 100%. I need to randomly assign the tasks based on the percentage defined which each employee can handle. For example, Shelia can handle 20% easy, 10% medium, and 70% hard tasks. How can I randomly assign these tasks to the entire department based on their predefined percentages.

Thanks for your assistance.
 
Hmmmm

You need a few more rules stated to really answer this.

Obviously, with your 20%/10%/70% as the example, it is impossible to achieve those percentages with anything less than 10 tasks assigned ... assuming that only whole numbers of tasks are allowed.

In the most trivial case ... assignment of one task to someone who has none ... that person is going to be 100% assigned to whatever level of difficulty the task has so the first task assigned is probably going to violate everyone's upper limit for some level (unless it's 100%.)

The second problem is that there is no statement about total tasks they can handle ... only the ratio is stated.
I would assume that, when assigning a new task to an employee, there would be some rule about how many tasks they are handling now as part of the criteria for deciding if they should get another one ... but that's not stated.
 
Also the check for whether a task has already been allocated or not.

Have you considered printing the tasks out and sticking them into 3 hats, then getting the employees to pull tasks out in their stated ratios?
:)


Assuming every person gets 10 tasks, so as to make up the 100%..
The 10 tasks are x easy, y medium, and z hard tasks.

Assuming the tasks are stored in a table with a spare field called 'allocated', and a field holding a unique numeric identifier called 'ID', with values of 1..n

Now, you need to select (x) easy tasks, (y) medium tasks and (z) hard tasks by person.

So , for each person,

Select * from table where allocated = 'N' and level = 'Easy'
..read (x) of them, and mark them as allocated = 'Y' then update.

Select * from table where allocated = 'N' and level = 'Medium'
..read (y) of them, and mark them as allocated = 'Y' then update.

..repeat for (z) instances of 'Hard'


Don't get bogged down by 'randomly' selecting the tasks.
Just cream off the first (n) rows and mark them allocated.

(If you want to make the allocations random, add them to the table randomly in the first instance and sort by ID)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top