time_tracker Code Exercise
The homework task is to create a basic time tracking app, like you might have at an agency that does work for a number of clients, and needs to track the number of hours to bill to each client.
There are two different classes of user: admins and regular users.
Both classes of user can log in, using their email as a username, and must log in to use the site. But authentication can be hardcoded: that is, assume every user has the password "foobar" and authenticate against that. On logging in, the user should stay logged in until they explicitly log out.
Admins can set up and modify projects. They can add and edit regular users. They also have a few reports available to them (more about reports below). You'll want a small script to seed the database with at least one admin.
Either class of user can allocate blocks of their time to different projects: for example, "I worked on the XYZCorp website redesign from 12:20 PM 3/1/2013 to 4:15 PM 3/1/2013." They can edit or delete these blocks of time afterwards. These blocks of time should never be allowed to overlap. The exact interface for working with these blocks is up to you.
There are two types of reports that admins (but not regular users) should be able to view: -- Given a certain project, and a date/time interval, how many hours total did all users log to that project during that time interval? -- Given a certain user, and a date/time interval, to which projects did that user log time in that interval, and how many hours per project?
In both these reports, the reported time should be rounded to the nearest quarter hour.
Approach and Issues encountered (and overcome):
- Getting authentication setup correctly was a bit fiddly
- I made a boolean field required in model and it made a form behavew strangely and it threw me off for a while
- A migration had a misplaced end, hard to see and error message comfusing.
- A migration has duplicate field for created_at but called 'timestamps' in the migration.
- One time the schema migrations table didn't update for a migration. Had to update manually.
- Used a partial for time listing.
- Decided against scope for times.
- Working on time entry, validation and reports.