Please describe your process for approaching the code challenge. What kind of planning did you do? Did your plans change as you began coding? At first,
- I thought to use Devise for User and Login Authentication
- CanCanCan gem for User Role, I want to get Admin and User role. Admin will be responsible for User Management and Report.
- I used Rails 6, Webpacker Then in the middle of coding, although devise, cancancan are all working well, I found the problem. I cannot work datepicker to show up. I try different means to solve it. I am still fairly new to rails 6 and webpacker so it gives me lots of headache. So I step down to Rails 5. I use a lot of time in building all three devise, cancancan and Rails 6, I just keep it simple when I back down to Rails 5.
Right now,
- I have two roles; Admin and User.
- Admin can do User Management and see Report. And also can do clockin/out. User can only do clockin/out.
- I make it a little beautiful with some Design theme from HiMaMa.
- I use acts_as_paranoid gem for logical delete. I want to keep track of history so I choose to soft delete.
- I use ransack for search. I definitely would like to search with username and email but unfortunately not included this time.
- I use kaminari gem for pagination.
Describe the schema design you chose. Why did you choose this design? What other alternatives did you consider?
I choose to have User(One) and ClockEvent(Many) relationship. In order to keep track of clockevent from user and vise vasa to know user info from clockevent. I also want to have another relation like Role to help the authentication process but in order to keep it simple, I just choose to have a flag for role. At first, I have superadminrole or userrole for cancancan gem, I remove it after I change the design.
If you were given another day to work on this, how would you spend it? What if you were given a month?
- I definitely want to add more test cases. I don’t have much time to add more test cases so if I have one more day, I would make it more emphasize.
- If I have a month, I will make to work with Rails 6, webpacker, devise and cancancan gem. I definitely would like to add better authentication.
- I also want to add more search criteria in Report part. For admin, it would be nice to have a good tracker to know everyone’s clockevent.
- I want to modify database schema by adding index to fetch data faster, some required column to use in the future for history purpose, and some more.
- I want to add security to website too. It is still so weak right now.
- And I want to add Cache in order to save memory and faster performance.
- I would like to handle more for the session.
- I need to add Rack Attack gem for blocking and throttling abusive requests. These are what I can think of right now. It may have more if I have a month to develop it.