{"id":22412997,"url":"https://github.com/marcosvbras/gamification-challenge","last_synced_at":"2026-04-17T05:03:33.815Z","repository":{"id":93743321,"uuid":"134094924","full_name":"marcosvbras/gamification-challenge","owner":"marcosvbras","description":"Practical challenge to Dito job interview, coded in Ruby and Rails Framework","archived":false,"fork":false,"pushed_at":"2018-05-21T14:41:27.000Z","size":1827,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T03:27:20.759Z","etag":null,"topics":["application","challenge","gamification","himym","mysql","rails","ruby","ruby-on-rails","web-app","website"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcosvbras.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-05-19T20:13:23.000Z","updated_at":"2018-05-24T21:44:21.000Z","dependencies_parsed_at":"2023-08-27T11:15:25.900Z","dependency_job_id":null,"html_url":"https://github.com/marcosvbras/gamification-challenge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcosvbras/gamification-challenge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosvbras%2Fgamification-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosvbras%2Fgamification-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosvbras%2Fgamification-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosvbras%2Fgamification-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcosvbras","download_url":"https://codeload.github.com/marcosvbras/gamification-challenge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosvbras%2Fgamification-challenge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262520753,"owners_count":23323762,"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":["application","challenge","gamification","himym","mysql","rails","ruby","ruby-on-rails","web-app","website"],"created_at":"2024-12-05T14:11:36.147Z","updated_at":"2026-04-17T05:03:33.789Z","avatar_url":"https://github.com/marcosvbras.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gamification Challenge\n\n## What is this?\n\nThis project was done to complete [Dito](http://dito.com.br/)'s challenge to Full-Stack Developer job.\n\n### Challenge Description\n\nUsers have scores that are sent daily to be processed in the [Dito](http://dito.com.br/)'s system. All user scores are sent to the system via ``.csv`` files and each file has a lot of lines with user scores.\n\nThis challenge is to develop a web application using [Rails](https://rubyonrails.org/). The application must have a **score processing service** and a page to list all scores stored in the database.\n\nThe **score processing service** must **watch a directory** and process new scores every time a new ``.csv`` file arrives in this directory. Each user score must be persisted in a database and a user cannot have more than 3126 points.\n\nThe ``.csv`` file must have lines with the following structure:\n``2018-05-14; Karla; 123;500;``. They are respectively: **date**, **username**, **uid** and **points** table columns.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.github.com/marcosvbras/gamification-challenge/master/githubimgs/challenge.gif\" alt=\"Custom image\"/\u003e\n\u003c/p\u003e\n\n## Environment\n\n### Application\n\nThe web application was written with **Ruby 2.5.1** and **Rails 5.2.0**. It is recommended to install these exactly versions for a correct running.\n\n### Database\n\nThe database used was **MySQL 5.7.22**.\n\n### Ruby dependencies\n\nAll dependencies are in ``Gemfile``, but I need to highlight a special Gem called [Filewatcher](https://github.com/thomasfl/filewatcher). It was totally necessary to make it all work.\n\n## :running: How to run\n\n1.  Set your MySQL's **user** and **password** in ``config/database.yml`` file.\n2.  On project root directory, run ``rake db:create``, ``rake db:migrate`` and ``rake db:seed`` to create the database and populate it.\n3.  On project root directory, run ``bundle install`` to install all ruby dependencies.\n4. Open the MySQL command line and set the following settings:\n```bash\nmysql\u003e set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';\nmysql\u003e set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';\n```\n5.  On project root directory, run ``rails server`` to start Puma server and that's it!\n\n## How it works\n\nYou must visit ``localhost:3000/scores`` to see the ranking page. It groups all scores by user and it is ordered to show who are the Big Players of the system.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.github.com/marcosvbras/gamification-challenge/master/githubimgs/index1.png\" alt=\"Custom image\"/\u003e\n\u003c/p\u003e\n\nTo see some magic happen here, everything you need to do is put some file from ``example_files/`` directory inside ``csv/``. If you want, you can create your own ``.csv`` file with the same structure of the other and put inside ``csv/`` directory as well. The system will know that there is a new score file and will process all new data. After that, you can reload the page and see new scores:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.github.com/marcosvbras/gamification-challenge/master/githubimgs/index2.png\" alt=\"Custom image\"/\u003e\n\u003c/p\u003e\n\nIf you click on some \"Ver Mais\" link, you will see all scores from a specific user:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.github.com/marcosvbras/gamification-challenge/master/githubimgs/index3.png\" alt=\"Custom image\"/\u003e\n\u003c/p\u003e\n\nIf you want to add other directories to be watched, you can just update the ``config.csv_directories`` variable in ``config/environments.development.rb`` with another path:\n\n```ruby\n# Directories to be watched for Filewatcher\nconfig.csv_directories = ['csv/*.csv', '/home/marcosvbras/test/*.csv']\n```\n\nNow, the ``/home/marcosvbras/test/*.csv`` directory is also being watched, and you can put some ``.csv`` files to be processed. Don't forget the file extension at the end of the path.\n\n## Final Considerations\n\nThis challenge was **LEGEN**...\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.github.com/marcosvbras/gamification-challenge/master/githubimgs/wfi.gif\" alt=\"Custom image\"/\u003e\n\u003c/p\u003e\n\n...**DARY**!\n\nIt's awesome to build things with Rails, everything is so intuitive and simple. With only few minutes you can have something running and the framework gives a lot of tips for you. The difficulty here was not being able to stop looking for ways to improve a small project like that.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcosvbras%2Fgamification-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcosvbras%2Fgamification-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcosvbras%2Fgamification-challenge/lists"}