[jQuery] Logic issue - can jQuery help?

[jQuery] Logic issue - can jQuery help?


I apologize if this is semi OT...
I have an odd performance problem that I can't see any clear logic
around. I was wondering if jQuery might be able to help me with this.
Situation.
1. I have a table of employees. Employees in the left column (one per
row), and days in the remaining columns. Some employees are team
leaders, some are team members. Teams can change at any time, and
employees may change their role from leader to member, or vice versa.
But an employee can only be on one team at a time.
2. I have a large list of "tasks" to be match up to the employee and
day. The only match to the employee is the employee ID.
Problem.
- Because teams can change I can potentially be viewing a period of time
where one employee has been on two (or more) different teams, and so
would rightfully have multiple rows of data. Therefore, I can't simply
use the employee ID as an element ID to find the row. (potential
duplicates).
- The only unique identifier I would have for each employee is a
combination of the employee ID, team leader ID, and start date.
- The task only knows the employee ID.
So, I'm looking for a way to match the task to the correct employee row,
while still satisfying the DTD requirements of not using duplicate ID
values. Once I know the row, I can determine the rest fairly easily.
But thus far the only method I have come up with includes some nested
loops which is resulting in significant delays. And even then, I still
have potential for duplicate IDs.
One thought that has occured to me (and I'll be trying out soon) is to
create a hash object where the employee is the key which points to an
array of employee objects. The employee object would contain a hased
ID value (combine employee id, leader id, start date for instance) that
will be unique. (or at least given a good statistical probability of
being unique). Then the further processing has the unique ID to find
the corresponding row, AND the data to determine which row (if more than
one) is pertinent. But, I've never done this kind of indexing before
and am concerned I may be introducing overhead and delays. Any
thoughts/comments here?
Thanks for letting me get this down in writing. Sometimes the answer
pops out at me when I do this. But not this time. Also thanks for any
tips or suggestions.
Shawn