Procrastination questionary! 1.0
Questionnaire based on ten random questions to calculate the participant's procrastination level.
The value of each answer varies according to the option chosen. In this case, A = 0, B = 0.5, and C = 1.
The live website can be found on this link.
The objective of the application is to offer the participant a result on the level of procrastination based on ten random questions.
These questions are stored in a file called q1.txt, which has thirty questions. The application will generate ten random questions that it obtains from this file.
When the participant finishes the questionnaire, the answers will be stored in a Google Sheet file along with their total result in the questionnaire.
At the end of the questionnaire, it will show the result of the participant, and if there is more than one participant, it will show the number of participants and their total average.
- Explanation and simple instructions for the user.
- Any user, regardless of their level, is capable of understanding and managing the application.
- The questionnaire is anonymous; at any time, a user can fill out the questionnaire.
- The user quickly understands the questions, and the options are clear.
- background: https://heropatterns.com/
- container: terminal with black background and white letters
Balsamiq is the software that has been used to develop the wireframes of the web. It was handy to start the idea of the project, and with it, I could quickly generate the code of the web structure. Captures developed with the Balsamiq program are attached below.
- The questionnaire starts in the introductory text when the user presses the "Enter" key.
- The file contains 30 questions of the questionnaire.
- The questionnaire loads a question from the file randomly.
- The user must choose between options A, B or C.
- Google Sheet document that stores the user's responses and their total result.
- Final screen that shows the result of the user's points.
- Results are calculated from 0-2: Low, 2-5: Medium, 5-8: High and 8-10: Extreme.
- If there is more than one user in the Google Sheet document, it will show the number of participants and the total average.
- Button to restart the questionnary
- Balsamiq used for creating wireframes in Desktop and Mobile versions.
- Chrome used for debugging and test the website.
- Firefox Developer Edition used for debugging and testing the website.
- Github is used to create and update the online repository of the project.
- Gitpod used for coding the project online.
- Ami used for generate the different responsive versions of the project.
- Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud, and was used to deploy the live project.
- Google_Sheet used to securely store user data entered in the project.
- PEP8 is used to validate Python code.
-
colorama is used for text coloring
-
gspread is used for save questionary data and results
-
pytest is used for test python code
The built-in tools of the Google Chrome and Firefox Developer Edition browsers have been used in the project. In this case, inspect each HTML and CSS element. These tools were also used to run different performance and optimization tests, such as Google Chrome's Lighthouse or the tools included to view the web on different device sizes.
To load the pytest tests you must run the command "pytest .\test_questionary.py" from the root directory.
For the validation of the python code, the official tool has been used pythonchecker.
TEST | RESULT | OK / FAIL |
---|---|---|
Run | Running Main function of Class Start | OK |
TEST | RESULT | OK / FAIL |
---|---|---|
print_intro | Running Main function of Class Start | OK |
press_enter_continue | Continue when press Enter key | OK |
run_questionary | Run questions, calculate points and added to row | OK |
print_user_result | Show user result | OK |
print_total_result | Show total of participants and average | OK |
TEST | RESULT | OK / FAIL |
---|---|---|
print_intro | Running Main function of Class Start | OK |
press_enter_continue | Continue when press Enter key | OK |
gspread_add_row_questionary | Added row to Google Sheet | OK |
run_questionary | Run questions, calculate points and added to row | OK |
print_options | Show questionary options A, B and C | OK |
questionary_total | Calculate points base on choices | OK |
print_user_result | Show user result | OK |
print_total_result | Show total of participants and average | OK |
shuffle_questions | Open file q1.txt and shuffle questions | OK |
TEST | RESULT | OK / FAIL |
---|---|---|
cls | clear screen windows/linux | OK |
TEST | RESULT | OK / FAIL |
---|---|---|
questions | count 30 questions in file | OK |
- Clear shell screen when needed depending on OS (linux and windows) with modules.Utils.cls()
- Show numbers in print results by convert numbers to str with function str()
- Splitting print lines adapting the max numbers of characters with ","
- Using @staticmethod in functions to declare static methods in modules.functions()
- Get properly formatted numbers from Google Sheet with the parameter value_render_option="UNFORMATTED_VALUE" in Functions.print_total_result()
- Added encoding="utf8" in line 161 of modules.functions.py to fix pyling suggestion
- Install pytest and addecuate all the functions in test_questionary.py
- Modified to str(round(sum(values_list) / len(values_list), 2)) in line 150 to show the total average of participants results
The main branch of this repository has been used for the deployed version of this application.
The project deployment was based on the Code-Institute-Org / python-essentials-template.
- Click the
Use This Template
button. - Add a repository name and brief description.
- Click the
Create Repository from Template
to create your repository. - To create a Gitpod workspace you then need to click
Gitpod
, this can take a few minutes. - When you want to work on the project it is best to open the workspace from Gitpod (rather than Github) as this will open your previous workspace rather than create a new one. You should pin the workspace so that it isn't deleted.
- Committing your work should be done often and should have clear/explanatory messages, use the following commands to make your commits:
-
git add .
: adds all modified files to a staging area -git commit -m "A message explaining your commit"
: commits all changes to a local repository. -git push
: pushes all your committed changes to your Github repository.
Forking the GitHub Repository
If you want to make changes to your repository without affecting it, you can make a copy of it by 'Forking' it. This ensures your original repository remains unchanged.
- Find the relevant GitHub repository
- In the top right corner of the page, click the Fork button (under your account)
- Your repository has now been 'Forked' and you have a copy to work on
Cloning the GitHub Repository
Cloning your repository will allow you to download a local version of the repository to be worked on. Cloning can also be a great way to backup your work.
- Find the relevant GitHub repository
- Press the arrow on the Code button
- Copy the link that is shown in the drop-down
- Now open Gitpod & select the directory location where you would like the clone created
- In the terminal type 'git clone' & then paste the link you copied on GitHub
- Press enter and your local clone will be created.
The project was deployed to Heroku using the following steps...
- Log in to Heroku and if not taken there automatically, navigate to your personal app dashboard.
- At the top of the page locate the 'New' drop down, click it and then select 'Create new app'.
- Give your application a unique name, select a region appropriate to your location and click the 'Create app' button.
- Your app should now be created so from the menu towards the top of the page click 'Settings'
- Click 'Reveal Config Vars' in the Config vars section and enter the key as
PORT
and the value as8000
. Click the Add button. - Under the 'Buildpacks' section click 'Add buildpack'.
- Select 'Python' and then click the 'Save changes' button.
- Click 'Add buildpack' again, select 'nodejs' and click the 'Save changes' button again.
- Ensure the build packs are ordered as below:
heroku/python
heroku/nodejs
- Navigate to the 'Deploy' page using the menu towards the top of the page.
- Select 'GitHub' from the 'Deployment method' section and you will be prompted to 'Connect to GitHub'.
- Once connected to your GitHub account you will be able to search for your repository which contains the battleships code.
- Once the repository is found click 'Connect'.
- At the bottom of the page find the section named 'Manual deploy', select the 'main' branch in the drop down and click the 'Deploy' button.
- Once deployment is complete, click the 'View' button to load the URL of the deployed application.
Please note it can take a while for this link to become fully active.
The live link can be found here.
- codeinstitute.net
- w3schools.com
- Many thanks to kasia_ci from Code Institute for all the guidance and info well provided during these weeks in the slack channel #msletb-mar-2022.
- Also thanks to channel buddies in #peer-code-review for the code suggestions.