I have an existing application that lets a company track the tutor/
student relationships through a Job model. I now want to add in
functionality that lets the tutors login and enter the time they spend
each week tutoring for each of their respective jobs.
im building this functionality into a rails app, but im not sure if im
modeling it in the best way.
For each active job there is a row that lists the client’s name as
well as each day of the week (monday → Sunday) so the tutor can enter
their hours, and minutes for that day.
I’m going to create a Timesheet model that stores the tutor_id, year
and week # (so I can just calculate the first day of week and iterate
from there). The Timesheet model will have a has_many relationship
to an Activity model that has the timesheet_id and job_id.
Activity will then have a has_many relationship to a Day model that
will include the date, hour and minute fields for each day.
Im not sure if that is the right way to go about it though.
class Job
belongs_to :student, :tutor
has_many :timesheets
end
class Timesheet
belongs_to :job
has_many :days
end
class Day
belongs_to :timesheet
end
Here’s a screenshot of my mockup for reference:
http://carpeaqua.com/images/tsmock.png
Any suggestions are appreciated.
Thanks!