Data modeling - representing data across models


#1

I’m having some difficulty deciding where to put logic that crosses
models.

For example, given models people, departments, work schedules, and
weeks.

Where would the following best fit:
who is scheduled to work in a given department in a given week?
how many hours is a given person scheduled in a given week?
how many hours is a given person scheduled in a department in given
week?
how many hours total are scheduled in a week?

The first three could possibly go in department or person, but doesn’t
feel exactly right. Especially because I have a lot of these type
problems and filling Person with methods like
num_hours_scheduled_by_department_and_week( department, week ) seems
rather messy.
The last doesn’t seem to fit in any existing model.

I guess the question boils down to where do you represent data that is
the intersection or composite of multiple models?

Thanks.


Jack C.
removed_email_address@domain.invalid