Allow teachers to clock-in/clock-out of their daycare center. When a teacher arrives to work, they clock-in, when leave they clock-out, and the platform keeps track of these events. Using Ruby on Rails (or equivalent MVC framework), build a basic MVP of a clock-in/out application, using traditional CRUD methods.
The app should:
- Present a clock-in/out screen that will:
- Allow a user to enter their name or log in
- Allow the user to clock either in or out
- Upon clock event, store this information
- Provide a list of all clock events with logged information
Other things to consider:
- A teacher may need to clock in/out multiple times a day (e.g., for lunch)
- A clock event may need to be edited or deleted
- Are there any validations or UI constraints.
Code and working prototype:
- Upload the application code to a repo and provide the link.
- Make the prototype available for testing by uploading to a free application server (such as Heroku) and provide the link.
In the README of your project, please answer the following questions:
- How did you approach this challenge?
- What schema design did you choose and why?
- If you were given another day to work on this, how would you spend it? What if you were given a month?
-
Instructions on how to build/run application
- ruby 2.7.2 has been used to develop this application. sqlite has been ussed for relational database
- To run this project one should have Ruby on Rails setup in his/her machine.
- Use Git Bash or cmd to run this application:
- Step 1: Go to project location using Git Bash (Example: cd /f/myrails/clock-in-out )
- Step 2: run "bundle install" (Example: bundle install )
- Step 3: run "rails db:setup" (Example: rails db:setup )
- Step 4: run "RAILS_ENV=test rails db:setup" for test cases (Example: RAILS_ENV=test rails db:setup )
- Step 5: run "rails test" for unit test (Example: rails test )
- Step 6: run "rails s" to start server (Example: rails s )
- Step 7: Visit "http://localhost:3000" in your browser
-
Approach to the solution:
- Since it is super easier and faster to build a CRUD (create, read, update, delete/destroy) application using Ruby on Rails I decided to go with Ruby on Rails (ruby 2.7.2 and rails 6.0.3.4) framework to accomplish this project. A simple form containing a text box (for teacher's name) and a check box (for clock in or out) has been used for allowing a teacher to create a clock in/out event. However, system generated current time is considered as logged time in this case. Note: checked box is considered as clock-in, whereas, unchecked box is considered as clock-out.
-
Schema design:
- A single table has ben used which contains "teacher_name:string" (for storing teacher's name), "teacher_clocked_in:boolean" (for storing clock in or out depending on checked or unchecked condition), and "teacher_logged_time" (for storing system generated current time). Teachers are not allowed to pick the time when creating a clock in-out event. Nevertheless, they can update the information in editing section.
-
What could be taken care of on getting extra time
- One more day to work on this:
- Use rspec for test cases
- Use user authentication for editing section. Only authorized users should edit information
- Text field validation (no numbers and special characters should be allowed)
- One month to work on this:
- Use CI/CD pipeline for running unit tests while committing
- Filter table (data) by teacher's name, date, hours
- Import bulk data from csv files by using API
- Pagination on the home page
- Clock in or out events should be created alternatively by a specific teacher. For example, a teacher who created a clock-in event cannot create another clock-in event immediately after that. Next time, s/he can create clock-out event only.
- One more day to work on this: