Live Site: Yoga Flow Class Record Terminal
Repository: Yoga Flow Class Record Repository
This project is for users who teach lessons in any field who work for themselves. The aim is to collect lesson data from the user for the purpose of calculating earnings and updating the worksheet.
It is made with the intention of helping a small business owner keep their financial information in order by keeping track of total earnings, both for the lesson added and a running total so far.
The calculations for the earnings of the class being added use the price data per class duration that is stored in a separate worksheet and the attendance data that is directly input by the user into the terminal. The terminal will then print the earnings to the user as well as store them back in the attendance worksheet.
- As a self-employed teacher I want to:
- Keep track of the business earnings
- Plan for the future growth of the business
Input of lesson data including:
- Day
- Date
- Time
- Duration
- Location
- Attendance and calculations
- Calculate earnings per class and update spreadsheet
- Calculate the total of all inputted lessons
- Calculations of the busiest days in the week
- Analytics of the current timetable over the month to decipher:
- Average student attendance per day
- Busiest time period throughout the month
- busiest time period throughout the year
The above should aid with decision making, such as making adjustments to the current timeable, running of workshops (when and where is best) and identifying capacity to add locations/lessons.
GitHub - Used to hold a repository of my project and deploy the live website to Git Pages, making it public.
GitPod โ Connected to GitHub, GitPod hosted the coding space, allowing the project to be built and then committed to the GitHub repository.
Heroku - Connected to GitHub repositiry, Heroku is a cloud application platform used to deploy this project so this backend language can be utilised/tested.
Google Sheets is used to create an online based spreadsheet.
Google Sheets API is used to link into my spreadsheet.
datetime to work with the date and time, ensuring it follows the correct format and doesn exceed the possible day and month.
Colorama is used to add colour to the terminal which adds to the users experience.
The project follows the below logic:
The user must input each entry of data individually as each item has to be validated using different parameters. Once all data is input the system makes its calculations. These inputs and calculations are then pushed back into the approproate worlsheet.
I have manually tested the projecy by:
- running through a PEP8 linter
- Intentionally added incorrect data to ensure the code rejects it
- Tested both in Gitpod and Heroku terminals
- Ensured the data input from the deployed terminal pushes the data back into the worksheet as expected (see images below)
The code was validated using PEP8. No errors were retruned.
During testing I found that the date was not in the dd/mm/yy format I thought I had set it as. To fix this I changed the order of the following line of code from "day, month, year" to be "year, month, date":
my_date = date(int(year), int(month), int(day))
I also found that some user input errors were terminating the code although I used a while loop. To fix this I identified which lines of code were causing the errors using the Traceback in the terminal. What I found was the code that was causing the break in the loop wasn't within the while loop. To fix this I placed the code in the loop and function began to work as expected.
Currently, there are no bugs found, however, the below pylint errors were appearing in the Problems tab:
I attempted to remove the errors however the variables I have stored globally were not working when moved into the module. Therefore I had to use the global keyword within the following functions:
- lesson_duration_data()
- lesson_location_data
- lesson_attendance_data
The below steps are to deploy to Heroku, this project has been re-deployed to Render.
This project was deployed using the Code Institutes mock terminal for Heroku.
I followed the following steps:
- Login to Heroku and Create a New App.
- Give the App a name, it must be unique, and select a region.
-
Click on 'Create App'. This will take you to a page where you can deploy your project.
-
Click on 'Settings' among the tabs at the top of the page. The following sets must be dione before deployment.
- Next, scroll down to Config Vars (also knownas Environment Variables). In order for Heroku to access my spreadsheet it must have access to the contents of the creds.json file. As this file is to be kept secure it cannot be found in my GitHub repository. To enable access securely, sensitive data is stored in a Config Vars.
-
Click 'Reveal Config Vars'. Where it says 'KEY', input CREDS and 'VALUE', input the contents of the creds.json file. Then click 'ADD'. I also had to add a second Config Vars of KEY: PORT and VALUE: 8000, to improve compatability with the Code Institute Template I am using.
-
Scroll down to Buildpacks. This adds futher required dependencies outside of the requirements.txt file. Click 'Add Buildpack', select 'python' first and then click 'Save Changes'. Then, add a second Buildpack, 'nodejs', to handle the mock terminal provided by The Code Institute.
The order of these Buildpacks is intentional, ensure Python is on top and nodejs underneath. The order can be changed by clicking and dragging.
- Go to the 'Deploy' section using the tabs at the top. Find the 'Deployment Method' section and choose GitHub. Then, I connected to my relevant GitHub Repository by searching the repository name and clicking 'Connect'.
- Scroll down to the Automatic and Manual Deploys sections. I have enabled Automatic Deploys as I want my project to automatically redeploy if push any changes back into my repository. I then clicked 'Deploy Branch' in the Manual Deploy section and waited as Heroku installed all dependencies and deployed my code.
- Once my code was finished deploying I clicked view, to see my newly deployed project in the terminal.
I used the following websites to help with different areas of my project:
-
Stack Overflow to test user input against the lesson_day list.
-
Stack Overflow to help with the while loop when writing the lesson day function.
-
Stack Overflow to aid with ensuring the date can be validated correctly in the lesson_date_data function.
-
Gspread Documentation to find out how to link to a column of data in a spreadsheet.
-
Colorama YouTube Video to find out how to use Colorama to change the text colour seen by the user in the terminal.
-
Lucid Charts to create the logic flow diagram for the project.
-
W3Schools to help with using the Global keyword.
-
Geeks for Geeks to help clear the list of user inputs (that were already pushed into the worksheet) if the user chooses to input more data for another lesson.
-
Maschituts for with the code to start the programme again if the user has more data to input.
-
Method 3 on this Geeks for Geeks article to turn a list of strings into a list of integers.
-
Programiz and Stock Overflow to help with using the index to check a user input.
-
Stack Overflow to help with comparing the users answer with a list.
-
Edureka to find out how to remove an item from a list.
-
Slack Overflow to help with working on the lesson_time_data function.
Thank you to all who encouraged and supported me as I created my first game, espcially to my mentor for his guidance and patience and tutor support at The Code Institute who helped when I was stuck.