Bar Chart with accomplished tasks

I need to create metric showing performance of tasks each working day.

Tasks are done by 3 people:

- first person working from 0:00 till 7:59

- second person working from 8:00 till 15:59

- third person working from 16:00 till 23:59

In the X-axis I have days, each day contains three bars (1,2,3 person) and they show performence (amount of tasks done that day/all task assigned to the person that day)

If the task comes on 22/12/2017 16:30 it should be done by person 3, but if it has not been done by person 3 it should goes to person 1 (if done by person 1 it should be included to his performence as task done on 23/12/2017), afterwards (if still not done) to person 2 and so on unitl the task is completed

Example of the table:

Task

TaskStartDate

TaskEndDate

task1

22/12/2017 16:30

23/12/2017 11:00

task2

09/01/2018 12:20

null

task3

06/01/2018 06:00

null

task4

12/12/2017 15:00

13/12/2017 14:00

task5

14/12/2017 9:00

15/12/2017 6:00

task6

03/12/2017 14:00

6/12/2017 11:00

I have problem with the script. How to make that task (TaskStartDate) will be moving from one person to another until is done? Should I use some loop? Could you please advise how it should look like?