Skip to content

Dima-Bulavenko/spa-booking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spa Booking

Spa Booking is a terminal application designed to simulate the process of booking specific spa services. It offers additional features such as booking cancellations, checking available times for a particular service and date, and accessing information about various services.

The primary objective of this project is to enhance Python skills. Additionally, it involves deploying on a Heroku server, creating unit tests with the Python unittest library, and implementing object-oriented programming principles.

Link to the live site

Contents

Table of contents generated with markdown-toc

User Experience UX

Target Audience

This application targets a narrow audience as it lacks a graphical user interface, which could complicate its usability. The audience primarily consists of programmers or companies seeking to integrate a booking system for their products.

Back to top

User Stories

  • As a user, I want to be able to highlight text in different colors.
  • As a user, I want information to be separated by corresponding groups using different symbols or spaces.
  • As a user, I want to receive notifications or messages for my actions.

Back to top

Project Aims

The aim of the project is to improve Python skills while also gaining experience in deploying applications on a Heroku server, creating comprehensive unit tests using the Python unittest library, and applying object-oriented programming principles.

Back to top

Flowchart

The flowchart was created using the Draw.io software.

flowchart

Structure

The application structure has four main branches:

  • Sheet manager - responsible for handling spreadsheet data.
  • Flow manager - responsible for flows of application.
  • Validators - responsible for validating user inputs.
  • Print manager - responsible for printing data to user.

Back to top

Sheet manager

The SpaSheet class manages the spreadsheet received from the API. It creates a sheet attribute that refers to the actual sheet for the API and creates attributes that refer to worksheet objects.

Back to top

Flow manager

The Spa Booking application comprises four flows (BookingFlow, CancelFlow, AvailabilityFlow, ServiceInfoFlow). Each flow corresponds to its own class, with each class inheriting from the basic class BasicFlow. This Object-Oriented Programming (OOP) approach enhances the application's flexibility and expandability, while also facilitating adherence to the Don't Repeat Yourself (DRY) principle.

All flows implement run_flow() method. The method runs set of methods, one by one, to complete the work of a flow.

Validators

The validators is place in validators.py file. The file has all validators to validate user input.

Ordinarily a validator passed to input handler() function. The function call the validator when user pass input.

Back to top

Print manager

To manage printings I created PrintMixin class. The class uses rich library to add styles for output and implements methods to print commonly used cases

Back to top

Features

Each feature include user data validation.

Choose option

Allow user to take one option from list.

choose service

Back to top

"yes no" feature

Allow user to confirm some action.

"yes no" feature

Back to top

Choose date

Allow user to input date for particular service to get schedule or information about the service.

choose date

Back to top

Choose time

Suggest available time for booking and allow user to choose time from list.

choose time

Back to top

Get credentials

Get user credentials like name of phone number.

get name

get phone

Back to top

Change data

Allow user to change data for booking

get name

Back to top

Booking

User can book service on particular date and time.

check feature

Booking cancellation

User can cancel his bookings by passing name and phone number which he used when book a service.

check feature

Check available time

User can check all available times for certain data and service

check feature

Service information

User can get information about a service.

check feature

Testing

User stories testing

Expectations Realisation
As a user
I want to highlight text in different colors. The application allows users to highlight text in various colors, providing a visual emphasis on important information or for categorizing content.
I want information to be separated by corresponding groups. Information within the application is separated into distinct groups using different symbols or spaces, ensuring clarity and organization, and making it easier for users to understand and navigate.
I want to receive notifications or messages for my actions. Users receive notifications or messages for their actions within the application, ensuring they stay informed about relevant updates or events, providing feedback and guidance throughout their interaction with the system.

Unit testing

Unit testing was performed by using built-in python library unittest. To run tests navigate to root directory of the project and use commands:

Windows:

python -m unittest discover tests

Linux, Unix:

python3 -m unittest discover tests

unittests

Unittest coverage was checked with coverage python library. To check the test code coverage need to user two commands.

  1. This command run all tests under the coverage library:

    coverage run -m unittest

  2. This command show report of coverage.

    coverage report

unittests

Back to top

PEP8 testing

PEP8 validation was performed by using Python linter. To follow PEP8 during development I used VSCode extensions such as Ruff and Pylance.

Check PEP8 validation here

Bugs

Fixed Bugs

  • The "validate_space_separated_integers()" don't intercept input with multiple the same integers closed issue.

  • Incorrect canceletion, when multiple bookings selected closed issue.

  • Invalid search of bookings for cancellation closed issue.

Unfixed Bugs

The Spa booking application doesn't have unfixed bugs.

Back to top

Technologies used

  • Python - is an interpreted, object-oriented, high-level programming language with dynamic semantics.
  • rich - python library to add color and style to terminal output.
  • unittest - python built-in library to create unittests.
  • coverage - python library to check test coverage
  • freezegun - python library that helps mock datetime module.
  • gspread - python interface for working with Google Sheets.
  • google-auth - python library for authentication to Google APIs.
  • GitHub - An online host for web and software development projects. Used to store the repository and deploy the finished website.
  • Git - Software for tracking changes to files. Used with GitPod to add, commit and push code changes to the repository on GitHub.
  • Heroku to deploy and host the live app.
  • Google Spreadsheets API to store data.
  • Google Drive to write an app to process requests to Spreadsheets.
  • draw.io - for creating flowcharts.

Back to top

Deploying

The application was hosted using Heroku, a cloud platform designed for building, deploying, and managing apps within containers.

Deployment Steps:

  1. Fork or clone this repository.
  2. Log in to your Heroku account.
  3. Create a new Heroku app.
  4. Navigate to the Settings tab.
  5. Set up environmental variables in the config vars section. In this case, it's CREDS(credentials of Google service account) and PORT(value 8000).
  6. Configure buildpacks in the following order: python and NodeJS.
  7. Set up GitHub integration, selecting the main branch in the Deploy tab.
  8. Click on Deploy branch to finalize the deployment process.

How to Clone

  1. Log into your account on GitHub
  2. Go to the repository of this project Spa booking
  3. Click on the code button, and copy your preferred clone link.
  4. Open the terminal in your code editor and change the current working directory to the location you want to use for the cloned directory.
  5. Type git clone into the terminal, paste the link you copied in step 3 and press enter.

Back to top

Credits

Content

  • mocking objects for unittesting

  • check test's coverage with python library coverage

  • mocking datetime.date.today() function with freezegun python library

  • phone number validation was performed by using phonenumbers library.

Back to top

Acknowledgements

I want to convey my immense gratitude to my mentor, Luke Buchanan, for pinpointing my mistakes and providing advice on how to rectify them. Special thanks to my friends who assisted in testing the application, and to the Slack community, always ready to offer valuable tips at any time.

Back to top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published