{"id":25781834,"url":"https://github.com/barek2k2/clock_event","last_synced_at":"2025-06-14T17:05:19.894Z","repository":{"id":143378029,"uuid":"363324824","full_name":"barek2k2/clock_event","owner":"barek2k2","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-02T05:30:32.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T08:19:37.076Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barek2k2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-01T04:48:09.000Z","updated_at":"2021-05-02T05:30:34.000Z","dependencies_parsed_at":"2023-09-13T22:31:37.734Z","dependency_job_id":null,"html_url":"https://github.com/barek2k2/clock_event","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/barek2k2/clock_event","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barek2k2%2Fclock_event","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barek2k2%2Fclock_event/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barek2k2%2Fclock_event/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barek2k2%2Fclock_event/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barek2k2","download_url":"https://codeload.github.com/barek2k2/clock_event/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barek2k2%2Fclock_event/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259851736,"owners_count":22921631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-27T07:31:00.781Z","updated_at":"2025-06-14T17:05:19.883Z","avatar_url":"https://github.com/barek2k2.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n* Online viewable at https://clock-event.herokuapp.com/\n\n### My approaches\n* I built the clock event entry application and ensured sequential events happens.\n  An user should not able to clock out before clock in and should not be able to clock in before clock out next time\n* For an editable event, the time should not be greater than next event and should not be less than the previous event\n  so that event sequence is maintained properly and historically.  \n* I used git and github for source code repository\n* Followed TDD(Test Driven Development) approach\n* Tried to make my code DRY as far as I can\n* Used PostgreSQL relational database to design the database schema\n* Used bootstrap to make the UI(basic) responsive\n* My Development environment was Linux(Ubuntu, Rubymine IDE, Ruby 2.6.6, Rails 5.2.5, google chrome)\n* Normally I try to design scalable software. I do analysis and do feasibility study before coding.\n  For this application I changed one of my plans. Initially I thought `event` record would contain\n  columns like `clocked_in_at clocked_out_at`. However I introduced `event_type` to make it more scalable\n  because the software can be scaled(in future perhaps) to track other events like `lunch` `meeting` `conference` `delivery` `pingpong` etc\n\n### Schema design\n```\n  create_table \"events\", force: :cascade do |t|\n    t.integer \"user_id\"\n    t.string \"event_type\"\n    t.datetime \"event_at\"\n    t.string \"location_ip\"\n    t.text \"user_agent\"\n    t.datetime \"created_at\", null: false\n    t.datetime \"updated_at\", null: false\n    t.index [\"user_id\"], name: \"index_events_on_user_id\"\n  end\n\n  create_table \"users\", force: :cascade do |t|\n    t.string \"email\", default: \"\", null: false\n    t.string \"encrypted_password\", default: \"\", null: false\n    t.string \"reset_password_token\"\n    t.datetime \"reset_password_sent_at\"\n    t.datetime \"remember_created_at\"\n    t.datetime \"created_at\", null: false\n    t.datetime \"updated_at\", null: false\n    t.index [\"email\"], name: \"index_users_on_email\", unique: true\n    t.index [\"reset_password_token\"], name: \"index_users_on_reset_password_token\", unique: true\n  end\n```\n* I designed 2 tables namely `users` and `events` where user has_many events and event \n  belongs to user. I tried my best to avoid data redundancy  in this schema and relationships.\n  `users` table is used for the authentication and `events` table is used for storing authenticated user's events\n* Introduced event_type(`clock_in`, `clock_out`) so that the event type can be extended(in the future) to other types\n  like `lunch`, `meeting`, `conference`, etc \n* Introduced `location_id` and `user_agent` to track user location and device\n  for collecting more valuable user's logs(generating more reports in future) under the hood\n* Alternatively I would choose NoSQL database like mongoDB or AWS RDS could be used  \n  \n### If I were given another day and had more time\n* I would like to develop microservice architecture using AWS(EC2, RDS, SES, Load Balancing), Twilio, Redis, etc\n* I would like to setup background job(like Sidekiq) to notify(if user forgets to clock out) the user via email/sms\n  to get clocked out after a certain time(like if the tracked hours is more than 8 hours a day)\n* I would design the database and architect the software like a SAAS(Software As A Service) \n* I would split the software architecture into frontend(React, Redux, JavaScript, NodeJS) and backend(JWT token based API in Rails) for better UX\n* I would setup CI(perhaps github actions) for continuous integration and automated deployment.\n* I would recommend another server for staging\n* I would like to develop a mobile app using React Native\n\n\n## RSpec test\n* `rake db:create RAILS_ENV=test`\n* `rake db:migrate RAILS_ENV=test`\n* `rspec`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarek2k2%2Fclock_event","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarek2k2%2Fclock_event","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarek2k2%2Fclock_event/lists"}