{"id":17226850,"url":"https://github.com/dantleech/run-logger-5000","last_synced_at":"2025-03-25T17:48:28.598Z","repository":{"id":66290758,"uuid":"116149538","full_name":"dantleech/run-logger-5000","owner":"dantleech","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-03T15:04:33.000Z","size":794,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T15:44:23.379Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/dantleech.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":"2018-01-03T15:01:20.000Z","updated_at":"2018-01-03T15:01:52.000Z","dependencies_parsed_at":"2023-02-22T13:00:38.065Z","dependency_job_id":null,"html_url":"https://github.com/dantleech/run-logger-5000","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2Frun-logger-5000","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2Frun-logger-5000/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2Frun-logger-5000/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2Frun-logger-5000/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dantleech","download_url":"https://codeload.github.com/dantleech/run-logger-5000/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245515137,"owners_count":20628112,"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":"2024-10-15T04:17:23.746Z","updated_at":"2025-03-25T17:48:28.575Z","avatar_url":"https://github.com/dantleech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"SF4 Run Logger Workshop\n-----------------------\n\n![runlogger](https://user-images.githubusercontent.com/530801/34525560-b1b22ab6-f09f-11e7-9993-5e125dee1b16.png)\n\nDisclaimer\n----------\n\nThis workshop provide an introduction to Symfony 4 and Flex, some previous\nknowledge of Symfony or a similar MVC framework would be an advantage.\n\nThis workshop will not attempt to be architecturally sophisticated.\n\nBrief\n-----\n\nAs a keen runner, you want to be able to keep track of the runs that you make.\n\nYou realise that you want to gradually work up to running a marathon in a\nyears time, and you want to gradually build up your weekly runs. You have\nalready got some regular routes:\n\n| Code | Route                     | Distance   |\n| ---- | ------------------------- | ---------- |\n| BG1  | Home to Brandenberg Gate  | 10km       |\n| TG1  | Tiergarten 1              | 15km       |\n| WSL3 | Weisensee Lake 3 loops    | 5km        |\n\nAnd you have been recording your times in your notebook:\n\n| Date        | Code | Time       | Notes                  |\n| ----------- | ---- | ---------- | -----------------------|\n| 2017-12-12  | BG1  | 50m        | Raining                |\n| 2017-12-34  | TG1  | 1h5m       | Right knee was painful |\n| 2018-01-02  | WSL3 | 23m        | Personal best!         |\n\nAnd you often work out some simple statistics:\n\n- **Minutes per kilometer**: `$minutes / $nbKilometers`\n- **Kilometers per hour**: `$nbKilometers / $minutes * 60`\n- **Marathon time**: `$minutesPerKilometer * 42.195`\n\nIn addition to being a keen runner, you are also an amazing and enthusiastic\nweb developer.\n\nMake a web application which does this!\n\nGetting Started\n----------------\n\nPre-requsites:\n\n- Composer\n- Database (sqlite3, mysql, whatever)\n\nCreated project using:\n\n    $ composer create-project symfony/skeleton sf4-workshop\n\nServe using:\n\n    $ php -S 127.0.0.1:8000 -t public\n\n### Database\n\n```\n$ composer require doctrine\n```\n\n- Use the `pdo_sqlite` driver (or whatever you prefer), see:\n    - `config/packages/doctrine.yaml`\n    - `.env`\n\n- Create entities `src/Entity/{Route,Run}`:\n\n\n```\n             +---------------+\n             | Route         |\n             +---------------+\n             | +title:string |\n             | +meters:int   |\n             +---------------+\n                      ^\n                      |\n            +-----------------+\n            | Run             |\n            +-----------------+\n            | +route:Route    |\n            | +date:DateTime  |\n            | +seconds:int    |\n            +-----------------+\n```\n\nDon't forget to add the mapping annotations:\nhttps://symfony.com/doc/current/doctrine.html#creating-an-entity-class\n\nAnd:\n\n```\n$ ./bin/console doctrine:schema:create --force\n```\n\nList routes\n-----------\n\n```gherkin\nScenario: List all routes\n    Given the following routes exist:\n        | title               | distance |\n        | Home to Inviqa      | 7km      |\n        | Brandenberg gate    | 12km     |\n    When I am on the route listing page\n    Then I should see the following routes listed:\n        | title            |\n        | Home to Inviqa   |\n        | Brandenberg gate |\n```\n\n1. Create a controller at `src/Controller/RouteController.php`\n2. Make it extend `Controller`\n3. Use `@Route(\"/routes\")` to route\n4. Include Twig `composer require twig`\n5. Create some routes (`INSERT INTO route (title, distance) VALUES (\"5K Park Run\", 5000)`).\n6. Render all routes as a table\n\nCreate Route\n------------\n\n```gherkin\nScenario: Create route\n    Given I am on the route listing page\n    When I create a new route \"Weisensee to Kreuzberg\" with distance \"10km\"\n    And I am on the route listing page\n    Then I should see the following routes listed:\n        | title                  |\n        | Weisensee to Kreuzberg |\n```\n\n1. Add a new route `/routes/add`.\n2. Create a symfony form for the route (`composer require form`) and\n   [documentation](http://symfony.com/doc/current/forms.html).\n3. Validate the route, persist it and redirect to the list page.\n\nView Route\n----------\n\n```gherkin\nScenario: View route\n    Given the following routes exist:\n        | title               | distance |\n        | Home to Inviqa      | 7km      |\n    And I am on the route listing page\n    When I click on route \"Home to Inviqa\"\n    Then I should see the \"Home to Inviqa\" route details\n```\n\n1. Add a new route `/routes/{id}/view`.\n2. Show the route details (i.e. title and number of meters).\n3. Link to view route from route list.\n\n**Bonus**: Use a parameter converter to load the doctrine entity.\n\nAdd Run\n-------\n\n```gherkin\nFeature: Log run\n    As a runner\n    In order that I can monitor and improve my performance\n    I need to be able to log my runs\n\n    Scenario: Log run\n        Given the following routes exist:\n            | title               | distance |\n            | Home to Inviqa      | 7km      |\n        And I am on the route page for \"Home to Inviqa\"\n        When I log a run with time \"35 minutes\"\n        Then I should see a success notification\n        And the run should be listed on the route page\n```\n\n1. Create `RunController` and add a log run action with route\n   `/routes/{routeId}/runs/log`\n2. Ensure that the runs are listed on the route view page.\n\nShow Run Statistics\n--------------------\n\n```gherkin\n    Scenario: View run statistics\n        Given I ran \"35 minutes\" on route \"Weisensee lake\"\n        And I am on the route page for \"Weisensee lake\"\n        Then I should see that my average speed was \"8.58kmph\"\n        And that my marathon time is \"4 hours 55 minutes\"\n```\n\n1. Create a new class `App\\Service\\Statistics` with methods `averageSpeed(int\n   $meters, int $seconds): int` and `marathonTime(int $meters, int $seconds):\n   int`. They should return __meters per hour__ and __time in seconds__ respectively.\n2. Create a Twig extension `App\\Twig\\RunLoggerExtension extends\n   Twig\\Extension`. Add filters `marathon_time` and `mph`.\n3. Apply the columns for the new values in the run table.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantleech%2Frun-logger-5000","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdantleech%2Frun-logger-5000","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantleech%2Frun-logger-5000/lists"}