Developer: Kieran Merrett
๐ป Visit live website
This is a command-line version of a workout log and workout generator.
The aim is to build a place for a user to store weight logs to use when working out and be able to generate a workout for the user depending on how long they have available. Workouts are random each time and vary in length depending on time.
- Project Goals
- User Experience
- User Stories
- Technical Design
- Technologies Used
- Features
- Validation
- Testing
- Bugs
- Deployment
- Credits
- Acknowledgements
- Generate a random workout for a user dependant on time
- Be able to log in/ register a new account.
- Log and update weights acheived in a previous workouts
- Create a log that is easy to use and clear to the user
- Ensure that users understand the purpose of the log
- Generate workouts which always vary in exercises/reps
Aimed towards people aged 16+ (recommended age for starting gym work outs), general gym enthusiasts looking for random workouts and people who like to track their workout weights
- A simple, error-free workout creation tool
- Straight-forward navigation
- Log personalisation once registered
- Adjustable log record
Click here to view instructions
On the main menu, users are presented with an ASCII art rendering of the name 'Workout Log'. Below the welcome graphic there are a couple of options for user to select from. Operation: Input a numeric value and press enter key.
- Login / Register
- Workout
- Exit
At any point in the log, if the user inputs a number or text which does not correspond to the available option then they will be prompt to try again.
Clicking the first option to login/register, you will then be asked to enter your first AND last name. If registered already, you must validate the email registered to the account and are then are taken to the 'user menu'.
If user is NOT registered, you will be asked to create a new profile, y/n? If 'No' entered, then you will be returned to the main menu. If yes, you will first be asked your age, this must validate between 16-100. Following age, you will be asked your email and then to confirm it. Once These steps have all been passed with no error, you will be taken to the 'user menu'
Once validated or after creating a new profile, you arrive at the user menu. Here are three options to choose from:
- Workout
- View your log
- Exit
Selecting option 1 here to Workout, you will be asked how long you want to workout for, 15, 25, 45 or 60 minutes. Depending on your selection being 1-4, a random workout is generated giving x4 'warm up' exercises and increasing by 2 for each workout length, 6-10 'Main workout' exercises.
It is personalised using your user name. Following the workout being generated, you are returned to the 'user menu'
Clicking option 2 will take you to your personalised log, first it generates a full list of your exercises and the weights associated to each on, displayed in kg. You the are asked if you would like to adjust your log, y/n?
If no, you are returned to the user menu. If yes then you are asked which exercise you would like to adjust with prompt to enter the exercise, asked the new value and following updating your log, it asks if you would like to adjust another.
If no, your returned to the main menu. If yes, your log is regenerated for ease of viewing with all new values and prompted again to enter exercise/ new value.
Selecting option 3, 'Exit' the user quits the workout log and exits the terminal.
Clicking the second option to Workout, you will be asked how long you want to workout for, 15, 25, 45 or 60 minutes. Depending on your selection being 1-4, a random workout is generated giving x4 'warm up' exercises and increasing by 2 for each workout length, 4-10 'Main workout' exercises.
As you are NOT logged in or registered at this point, you are returned to the main menu.
Selecting option 3, 'Exit' the user quits the workout log and exits the terminal.
- I want to have clear options to select in the main menu
- I want to be able to generate a workout quickly
- I want to have different workouts each time
- I want to be able to sign up/ login
- I want to be able to view my weights log
- I want to be able to adjust my workout log weight value stored
- I want users to have a positive experience whilst using the log
- I want users to select options from the menus easily
- I want user names and emails to be stored on Google Sheets
- I want the user to get feedback on an incorrect input
- I want data entry to be validated
- I want the users to have an option to Exit the log
The following flowchart summarises the structure and logic of the application.
- Python programming language for the logic of the program
- Miro.com was used to draw the flowchart
- GitHub was used to store the project code
- Google Cloud Platform was used to manage access and permissions for Google Services such as Google auth, sheets etc.
- Google Sheets was used to store user details, user log and exercises for user
- PEP8 used to validate my python code
- Heroku was used to deploy the project into live environment
- Gitpod Workspace used to write the project code using Code Institute template
- random - used to randomise the workout when generating
- re - used for random expression validation when getting user email address
- colorama - JUSTIFICATION: I used this to add color to the terminal. I marked warning/error information with color red and user feedback with blue and green.
- gspread - JUSTIFICATION: I used gspread to add and manipulate data in my Google spreadsheet and to interact with Google API.
- google.oauth2.service_account - JUSTIFICATION: module used to set up the authentification needed to access the Google API and connect my Service Account with the Credentials function. A creds.json file is created with all details the API needs to access the google account. In deployment to Heroku this information is stored in the config var section.
- Provides user with graphic welcome message
- Gives user option to workout or signin / register
- User stories covered: 1, 2, 4, 8, 12
- Generate a workout for the user
- Workout suited to time specified
- Give variety in the workout
- User stories covered: 2, 3, 7
- Gives the user the option to exit the workout log completely
- Appearing in both the main menu and the user menu
- User stories covered: 7, 12
- This gives the user the chance to sign up or log into their personal workout log
- Their data is stored and validated with Google Sheets
- User stories covered: 9, 11
- Once signed up or logged in, this menu is where the user can decide to view their log, generate a workout or exit
- User stories covered: 1, 2, 5, 8, 12
- Here the user can view the currently stored information for their profile
- User stories covered: 5
- Here the usere is given the chance to adjust their current log information for a specific exercise
- User stories covered: 6, 7, 11
- Upon incorrect information input across the workout log, value errors and input errors are raised if necessary and feedback given towards the correct input required.
- User stories covered: 10, 11
PEP8 Validation Service was used to varify python code requirements. All the code passes with no errors and no warnings to show.
The testing approach is as follows:
- Manual testing of user stories
- I want to have clear options to select in the main menu
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Main Menu | Load up the Program | Main menu to load up without any issues and display the workout log logo | Worked as expected |
- I want to be able to generate a workout quickly
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Workout | Select option 2 from the main menu, select a length of time to workout | Workout to be generated giving a different amount of workouts depending on time selected | worked as expected |
User Menu | Select option 1 from the user menu, select a length of time to workout | Workout to be generated, attaching the users name and giving a different amount of workouts depending on time selected | worked as expected |
- I want to have different workouts each time
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Workout | repeating the process of selecting a 15 minute workout three times | Each workout to be different to the last in both 'warm up' and 'main workout' exercises | worked as expected |
- I want to be able to sign up/ login
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Login / Register | Input my first and last name and worked through the following questions | A profile not to be under my name so asked to create new profile. Worked through the questions following and a new profile created. Arrive at the user menu | worked as expected |
Login / Register | Input my first and last name | A profile under my name to be found and asked to confirm the email registered before continuing to the user menu | worked as expected |
- I want to be able to view my weights log
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
View Log | Once passing login'register, select option 2 from the user menu to view user log | Log to be displayed and to reference the users name to show this log is specific to this user | worked as expected |
- I want to be able to adjust my workout log weight value stored
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Adjust log | Once passing login'register, select option 2 from the user menu to view user log, then answer yes to the adjust log question, enter the name of the exercise i wish to adjust then its new value. Then i answered yes to the adjust again question to view updated log | Input of exercise name to be matched and its new value to be updated, giving confirmation of exercise and new value. Updating when full log request next viewed | worked as expected |
- I want users to have a positive experience whilst using the log
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Across all screens | Simple navigation through each menu | responses to input to be given without issues | worked as expected |
- I want users to select options from the menus easily
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Main Menu | Load up the main program and select an option | Be presented with a choice of options and an easy way to identify your choice | worked as expected |
User Menu | Log into the main program and progress through to the user menu | Be presented with a choice of options and an easy way to identify your choice | worked as expected |
- I want user names and emails to be stored on Google Sheets
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Login / Register | Sign up to the program and progress through the menus as a new user | profile to be created and my information to be stored when logging in next time | worked as expected |
- I want the user to get feedback on an incorrect input
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
across all inputs | enter incorrect information which could potentialy be accepted or throw an error | Value error to be raised and asked again for your input | worked as expected |
- I want data entry to be validated
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Login/regster | Attempt to sign in using a mixture of uppercase and lower case letters combined | Profile to be found and not asked to sign up to a new one | worked as expected |
Adjust log | Attempt to adjust log using letters and numbers | Value error to be thrown and asked to input just numbers only | worked as expected |
- I want the users to have an option to Exit the log
Feature | Action | Expected Result | Actual Result |
---|---|---|---|
Main menu | From the main menu, select option 3 | expect the program to provide message giving feedback before exiting the program. No more further inputs affect the program | worked as expected |
User menu | From the User menu, select option 3 | expect the program to provide message giving feedback before exiting the program. No more further inputs affect the program | worked as expected |
Bug | Fix |
---|---|
PEP8 validation issue linked to ASCII image '' errors | add 'r' prefix for string literals before the string so it isnt interpreting '' as an escape. |
whitespace being allowed in the email input bar | adjust input bar to remove any whitespace found. Swap (" " for "") |
White space before inputting user name generating a new profile to be created | Adjust so the titled_input is a make up of white space being joined to the use input and using .rstrip() remove any trailing whitespace also |
Mixture of upper and lower letters when inputting users names, causing the system to create new profile | Adjust so the input uses .title() when submitting information to ensure ONLY the first letter is uppercase |
This application has been deployed from GitHub to Heroku by following the steps:
Steps
First Enter the following into Github Terminal to get the requirements for heroku. 'pip3 freeze > requirements.txt'
![](docs/deployment/heroku-deployment-git-1.png)
Once you have your requirements generated, save and push the changes to github.
![](docs/deployment/heroku-deployment-git-2.png)
Go to Heroku and Sign up or Login
![](docs/deployment/heroku-deployment-1.png)
![](docs/deployment/heroku-deployment-2.png)
![](docs/deployment/heroku-deployment-3.png)
On the right click new and create new app
![](docs/deployment/heroku-deployment-4.png)
Enter an app name and select your area then click create
![](docs/deployment/heroku-deployment-5.png)
First go to the settings tab
![](docs/deployment/heroku-deployment-6.png)
Click reveal config vars
![](docs/deployment/heroku-deployment-7.png)
In this box type 'CREDS'
![](docs/deployment/heroku-deployment-8.png)
Head over to your project and to the creds.json file, copy its contents over to the value box.
![](docs/deployment/heroku-deployment-9.png)
Copy into the value box and click 'add'
![](docs/deployment/heroku-deployment-10.png)
![](docs/deployment/heroku-deployment-11.png)
![](docs/deployment/heroku-deployment-12.png)
Add the buildpacks in the correct order with Python first and Nodejs 2nd
![](docs/deployment/heroku-deployment-13.png)
![](docs/deployment/heroku-deployment-14.png)
![](docs/deployment/heroku-deployment-15.png)
Head back over to the deploy tab
![](docs/deployment/heroku-deployment-16.png)
Connect to your Github Account and search your project name
![](docs/deployment/heroku-deployment-17.png)
Click 'connect' to link your project
![](docs/deployment/heroku-deployment-18.png)
![](docs/deployment/heroku-deployment-19.png)
First select which branch you wish to deploy, then either auto deploy or manual. Auto means each time you push changes Heroku will automatically update the app. Manual means YOU have to update yourself
![](docs/deployment/heroku-deployment-20.png)
![](docs/deployment/heroku-deployment-21.png)
Your app is being built
![](docs/deployment/heroku-deployment-22.png)
Click to view completed app
![](docs/deployment/heroku-deployment-23.png)
![](docs/deployment/heroku-deployment-24.png)
- Go to the GitHub repository
- Click on Fork button in top right corner
- You will then have a copy of the repository in your own GitHub account.
- Go to the GitHub repository
- Locate the Code button above the list of files and click it
- Highlight the "HTTPS" button to clone with HTTPS and copy the link
- Open Git Bash
- Change the current working directory to the one where you want the cloned directory
- Type git clone and paste the URL from the clipboard ($ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY)
- Press Enter to create your local clone
- Flaticon was used for the website favicon
- Code Institute - for git template IDE and "Love Sandwiches - Essentials Project" which helped me with connecting the Google Spreadsheet to my project.
- gspread documentation explained how to obtain a specific value from the google spreadsheet
- Instructions how to print colored text from here
I would like to thank everyone who supported me in the development of this project:
- My mentor Mo for professional guidance, helpful feedback and words of encouragement whilst creating the project.
- Code Institute community on Slack for resources and support