V
V
Vesax2014-11-03 09:29:12
PHP
Vesax, 2014-11-03 09:29:12

How to organize work with schedules (schedules)?

There are 2 entities: Tutor and student.
The tutor creates his own schedule, in fact, indicates the working time up to hours and minutes. 3.11.2014 9:00 - 3.11.2014 13:00, for example.
The student in the same format indicates the time when it is convenient for him to study.
The task is to select a tutor for a student based on their schedules.
Question: How to implement this? (store in the database, process)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2014-11-03
@Vesax

The general principle of finding intersections on two such charts is to convert them into one common list (interval start/end time, code), where code +1 indicates the beginning of the interval, -1 the end of the interval. Then sort the list by time and go through it counting the intermediate sum of the codes. Where the sum becomes equal to 2, the coinciding period begins.
Further, the decision depends on many other conditions, for example, the minimum and maximum duration of a tutor's lesson with one student, where classes are held - in one place, or the tutor needs to travel around the students.
There may not be a direct solution here, on the topics of "scheduling classes" people write theses.

X
xmoonlight, 2014-11-03
@xmoonlight

xor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question